What you'll learn
This revision guide covers the three number systems used in computer science: binary, denary and hexadecimal. You will learn how to convert between these systems and understand why computers use different number bases. These skills are essential for the CIE IGCSE Computer Science exam and form the foundation for understanding how computers store and process data.
Key terms and definitions
Binary — a base-2 number system using only the digits 0 and 1, used by computers because it corresponds to the two states (on/off) of electronic switches
Denary — a base-10 number system using digits 0-9, the standard number system humans use for everyday counting and calculation
Hexadecimal — a base-16 number system using digits 0-9 and letters A-F, commonly used as a shorthand for binary in computing
Bit — a single binary digit, either 0 or 1, the smallest unit of data in computing
Byte — a group of 8 bits, the standard unit for measuring data storage and memory
Place value — the value of a digit determined by its position within a number, calculated by multiplying the digit by the base raised to the power of its position
Most Significant Bit (MSB) — the leftmost bit in a binary number, representing the highest place value
Least Significant Bit (LSB) — the rightmost bit in a binary number, representing the lowest place value (units)
Core concepts
Understanding number systems and bases
Every number system has a base (or radix) that determines how many unique digits are available and the place value of each position.
Denary (Base-10)
- Uses 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
- Each position represents a power of 10
- Place values from right to left: 1, 10, 100, 1000, 10000...
- Example: 2534 = (2 × 1000) + (5 × 100) + (3 × 10) + (4 × 1)
Binary (Base-2)
- Uses 2 digits: 0 and 1
- Each position represents a power of 2
- Place values from right to left: 1, 2, 4, 8, 16, 32, 64, 128...
- Computers use binary because electronic circuits have two states: on (1) and off (0)
- Example: 10110101 represents a specific value by combining these place values
Hexadecimal (Base-16)
- Uses 16 symbols: 0-9 and A-F (where A=10, B=11, C=12, D=13, E=14, F=15)
- Each position represents a power of 16
- Place values from right to left: 1, 16, 256, 4096...
- Used by programmers as a shorthand for binary
- One hexadecimal digit represents exactly 4 binary digits (bits)
Converting from binary to denary
To convert a binary number to denary, use the place value method:
Step-by-step process:
- Write the binary number
- Write the place values above each bit (128, 64, 32, 16, 8, 4, 2, 1 for an 8-bit number)
- Multiply each bit by its place value
- Add all the results together
Example: Convert 11010110 to denary
| Place value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|
| Binary digit | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 0 |
| Calculation | 128 | 64 | 0 | 16 | 0 | 4 | 2 | 0 |
128 + 64 + 16 + 4 + 2 = 214
Quick method for smaller numbers:
- Start from the right (LSB)
- Add the place value for each 1
- Ignore positions with 0
Converting from denary to binary
The most reliable method for IGCSE is repeated division by 2:
Step-by-step process:
- Divide the denary number by 2
- Record the remainder (0 or 1)
- Divide the quotient by 2
- Repeat until the quotient is 0
- Read the remainders from bottom to top
Example: Convert 157 to binary
| Division | Quotient | Remainder |
|---|---|---|
| 157 ÷ 2 | 78 | 1 |
| 78 ÷ 2 | 39 | 0 |
| 39 ÷ 2 | 19 | 1 |
| 19 ÷ 2 | 9 | 1 |
| 9 ÷ 2 | 4 | 1 |
| 4 ÷ 2 | 2 | 0 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Reading from bottom to top: 10011101
Alternative subtraction method:
- Write out the binary place values
- Start from the largest place value that fits into your number
- Subtract it and place a 1
- Move to the next place value
- If it fits, subtract and place a 1; if not, place a 0
- Continue to the end
Converting between binary and hexadecimal
Binary and hexadecimal have a direct relationship: one hexadecimal digit equals exactly 4 bits.
Binary to hexadecimal:
- Split the binary number into groups of 4 bits, starting from the right
- Add leading zeros to the leftmost group if needed
- Convert each group of 4 bits to its hexadecimal equivalent
- Combine the hexadecimal digits
Conversion table:
| Binary | Hex | Denary |
|---|---|---|
| 0000 | 0 | 0 |
| 0001 | 1 | 1 |
| 0010 | 2 | 2 |
| 0011 | 3 | 3 |
| 0100 | 4 | 4 |
| 0101 | 5 | 5 |
| 0110 | 6 | 6 |
| 0111 | 7 | 7 |
| 1000 | 8 | 8 |
| 1001 | 9 | 9 |
| 1010 | A | 10 |
| 1011 | B | 11 |
| 1100 | C | 12 |
| 1101 | D | 13 |
| 1110 | E | 14 |
| 1111 | F | 15 |
Example: Convert 11010110 to hexadecimal
Split into groups: 1101 | 0110
- 1101 = D
- 0110 = 6
Result: D6
Hexadecimal to binary:
- Convert each hexadecimal digit to its 4-bit binary equivalent
- Combine all the binary groups
- Keep all leading zeros for each group of 4
Example: Convert 3F to binary
- 3 = 0011
- F = 1111
Result: 00111111
Converting between denary and hexadecimal
Denary to hexadecimal:
Use repeated division by 16:
- Divide the denary number by 16
- Record the remainder (0-15, converting 10-15 to A-F)
- Divide the quotient by 16
- Repeat until the quotient is 0
- Read the remainders from bottom to top
Example: Convert 188 to hexadecimal
| Division | Quotient | Remainder | Hex |
|---|---|---|---|
| 188 ÷ 16 | 11 | 12 | C |
| 11 ÷ 16 | 0 | 11 | B |
Reading from bottom to top: BC
Hexadecimal to denary:
Use place values (powers of 16):
- Write the hexadecimal number
- Write the place values above each digit (4096, 256, 16, 1)
- Convert any letters to their denary values (A=10, B=11, etc.)
- Multiply each digit by its place value
- Add all the results
Example: Convert 2A7 to denary
| Place value | 256 | 16 | 1 |
|---|---|---|---|
| Hex digit | 2 | A | 7 |
| Denary | 2 | 10 | 7 |
| Calculation | 512 | 160 | 7 |
512 + 160 + 7 = 679
Why computers use different number systems
Binary advantages:
- Directly represents the two states of electronic switches (transistors)
- Reliable and less prone to errors
- Simple logic circuits can process binary
- All data in computers is ultimately stored as binary
Hexadecimal advantages:
- More compact than binary (one hex digit replaces four binary digits)
- Easier for programmers to read and write than long binary strings
- Commonly used for memory addresses, colour codes (e.g., #FF5733), and error codes
- Reduces the chance of transcription errors
- Direct conversion to/from binary without calculation
Practical applications:
- MAC addresses: 00:1A:2B:3C:4D:5E (hexadecimal)
- IPv6 addresses: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 (hexadecimal)
- HTML colour codes: #FF0000 for red (hexadecimal)
- Machine code debugging and memory dumps (hexadecimal)
Worked examples
Example 1: Multi-step conversion
Question: A computer stores the denary number 203 in an 8-bit register.
(a) Convert 203 to binary. [2 marks] (b) Express your answer from part (a) in hexadecimal. [2 marks]
Solution:
(a) Using repeated division by 2:
| Division | Quotient | Remainder |
|---|---|---|
| 203 ÷ 2 | 101 | 1 |
| 101 ÷ 2 | 50 | 1 |
| 50 ÷ 2 | 25 | 0 |
| 25 ÷ 2 | 12 | 1 |
| 12 ÷ 2 | 6 | 0 |
| 6 ÷ 2 | 3 | 0 |
| 3 ÷ 2 | 1 | 1 |
| 1 ÷ 2 | 0 | 1 |
Reading from bottom to top: 11001011 [1 mark for method, 1 mark for correct answer]
(b) Split binary into groups of 4:
- 1100 = C
- 1011 = B
Answer: CB [1 mark for grouping correctly, 1 mark for correct conversion]
Example 2: Binary to denary
Question: A programmer sees the binary value 10110101 displayed during debugging.
Calculate the denary equivalent of this binary number. Show your working. [3 marks]
Solution:
Using place values:
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 |
= 128 + 32 + 16 + 4 + 1 [1 mark for identifying place values, 1 mark for correct method]
= 181 [1 mark for correct answer]
Example 3: Hexadecimal to denary
Question: A MAC address contains the hexadecimal value 9E.
Convert 9E to denary. [2 marks]
Solution:
9E = (9 × 16) + (14 × 1) [1 mark for correct method with place values]
= 144 + 14
= 158 [1 mark for correct answer]
Common mistakes and how to avoid them
Forgetting to read remainders from bottom to top in denary to binary conversion. Always write "Read from bottom to top" or use an arrow in your working to remind yourself.
Mixing up hexadecimal letters with denary values. Remember: A=10, B=11, C=12, D=13, E=14, F=15. Make a small reference table in your margin if needed.
Not grouping binary correctly for hexadecimal conversion. Always group from right to left in groups of 4. Add leading zeros to the leftmost group if needed: 110101 becomes 0011 | 0101.
Using the wrong place values. Binary uses powers of 2 (1, 2, 4, 8, 16, 32, 64, 128...), denary uses powers of 10 (1, 10, 100, 1000...), hexadecimal uses powers of 16 (1, 16, 256, 4096...). Write them out at the start of your calculation.
Forgetting that each hex digit must be exactly 4 bits. When converting binary to hex, the grouping must be precise. 1010 = A, but 101 alone cannot be converted without adding a leading zero: 0101 = 5.
Not showing working in exam answers. Even if you can do conversions mentally, examiners need to see your method to award marks if your final answer is wrong. Always show place values, divisions, or groupings.
Exam technique for "Data representation: number systems (binary, denary, hexadecimal) and conversion between them"
Command words matter. "Convert" means perform the number system change and show working. "Calculate" also requires working. "State" means give the answer only, but showing brief working is still safer for marks.
Mark allocation indicates detail required. A 1-mark question needs just the answer. A 2-3 mark question requires method and answer. Use the marks as a guide: if 2 marks are available, ensure you show two clear steps or pieces of working.
Use tables and clear layout. Examiners can follow your working more easily with place value tables or clear division tables. This increases your chance of earning method marks even if your final answer is incorrect.
Check your answer makes sense. If converting 255 to binary gives you 3 bits, you've made an error (it should be 11111111). If converting FF to denary gives you 16, you've miscalculated (it should be 255).
Quick revision summary
Computers use binary (base-2) for internal processing, with each bit representing on/off states. Hexadecimal (base-16) provides a compact notation where one hex digit equals four binary bits. Denary (base-10) is the human-readable format. Convert binary to denary using place values (powers of 2). Convert denary to binary using repeated division by 2, reading remainders bottom to top. Convert binary to hex by grouping 4 bits at a time. Convert hex to binary by expanding each digit to 4 bits. For denary-hex conversions, use repeated division by 16 or place value multiplication.