Every value a computer stores is ultimately binary. This page walks through converting between decimal, binary and hexadecimal, and how characters are represented as numbers — then tests you with exam-style questions.
Repeatedly divide the number by 2, writing down the remainder each time, until you reach 0. Reading the remainders from bottom to top gives you the binary value.
Try it yourself — enter a decimal number to see the conversion, step by step:
| Value | ÷ 2 | Quotient | Remainder |
|---|---|---|---|
| 45 | ÷ 2 | 22 | 1 |
| 22 | ÷ 2 | 11 | 0 |
| 11 | ÷ 2 | 5 | 1 |
| 5 | ÷ 2 | 2 | 1 |
| 2 | ÷ 2 | 1 | 0 |
| 1 | ÷ 2 | 0 | 1 |
Read the remainders from bottom to top:
101101
2D
Each hexadecimal digit represents exactly 4 binary bits, which makes conversion fast: group the binary digits into sets of 4 (starting from the right), then convert each group.
1101 1010 D A → DA (hex)
ASCII assigns every character a unique number. A handful of values come up constantly in exam questions — worth memorising:
| Character(s) | ASCII code |
|---|---|
| '0'–'9' | 48 |
| 'A' | 65 |
| 'Z' | 90 |
| 'a' | 97 |
| 'z' | 122 |
| space | 32 |
Handy trick: uppercase and lowercase letters are exactly 32 apart (e.g. 'A' = 65, 'a' = 97).
Question 1
Convert the decimal number 45 to binary.
Question 2
Convert the binary number 110101 to decimal.
Question 3
How many unique combinations (values) can be represented using 6 bits?
Question 4
An unsigned integer is stored using 8 bits. What is the maximum value that can be represented?
Question 5
Convert the binary number 1101 1010 to hexadecimal.
1101 1010
Question 6
What is the ASCII decimal code for the uppercase letter 'A'?
Question 7
Why does Unicode/UTF-8 exist alongside the older ASCII standard?
Question 8
A calculation on an 8-bit unsigned integer produces the result 250 + 10 = 260. What happens?
Question 9
Convert the decimal number 200 to hexadecimal.
Question 10
A screen uses 8 bits per colour channel (Red, Green, Blue). How many distinct colours can a single pixel display?
Question 11
Convert the hexadecimal number 2F to decimal.
Question 12
What is the ASCII decimal code for the digit character '5' (not the number 5, the character)?
Question 13
Add the binary numbers 0101 and 0011.
0101 + 0011
Question 14
Convert the decimal number 100 to binary.
Question 15
Convert the hexadecimal number FF to decimal.
Question 16
Why do programmers often use hexadecimal instead of binary when representing byte values (e.g. colour codes, memory addresses)?
Question 17
What is the ASCII decimal code for the lowercase letter 'z'?
Question 18
A file is 2,097,152 bytes in size. How many megabytes (MB) is this, using 1 MB = 1,048,576 bytes?
Question 19
Subtract the binary numbers: 1010 − 0011.
1010 - 0011