CS16: Converting Number Bases
Step-by-step methods for converting between binary, decimal and hexadecimal - the essential skill for GCSE Computer Science.
Step-by-step methods for converting between binary, decimal and hexadecimal - the essential skill for GCSE Computer Science.
| From | To | Method |
|---|---|---|
| Binary | Decimal | Add up positional values where bit is 1 |
| Decimal | Binary | Repeated division by 2 (or subtract largest power of 2) |
| Hex | Decimal | Multiply each digit by its place value and add |
| Decimal | Hex | Repeated division by 16 |
| Binary | Hex | Group bits into fours, convert each group |
| Hex | Binary | Expand each hex digit to 4 bits |
Place values: 128 64 32 16 8 4 2 1 Binary: 1 0 1 1 0 1 0 0 128 + 0 + 32 + 16 + 0 + 4 + 0 + 0 = 180
Place values: 128 64 32 16 8 4 2 1 Binary: 0 1 1 0 1 0 1 1 0 + 64 + 32 + 0 + 8 + 0 + 2 + 1 = 107
107 / 2 = 53 remainder 1 53 / 2 = 26 remainder 1 26 / 2 = 13 remainder 0 13 / 2 = 6 remainder 1 6 / 2 = 3 remainder 0 3 / 2 = 1 remainder 1 1 / 2 = 0 remainder 1
Read remainders from BOTTOM to TOP: 1101011
In 8 bits: 01101011
180 - 128 = 52 β bit 7 = 1 52 - 64 = can't β bit 6 = 0 52 - 32 = 20 β bit 5 = 1 20 - 16 = 4 β bit 4 = 1 4 - 8 = can't β bit 3 = 0 4 - 4 = 0 β bit 2 = 1 0 - 2 = can't β bit 1 = 0 0 - 1 = can't β bit 0 = 0
Result: 10110100
3C4 = 3 x 256 + C x 16 + 4 x 1
= 3 x 256 + 12 x 16 + 4 x 1
= 768 + 192 + 4
= 964
FF = F x 16 + F x 1 = 15 x 16 + 15 x 1 = 240 + 15 = 255
964 / 16 = 60 remainder 4 60 / 16 = 3 remainder 12 (= C) 3 / 16 = 0 remainder 3
Read from bottom to top: 3C4
255 / 16 = 15 remainder 15 (= F) 15 / 16 = 0 remainder 15 (= F)
Read from bottom to top: FF
Binary: 1101 0110 Groups: D 6
Result: D6
Binary: 1011 0011 1101 0110 Groups: B 3 D 6
Result: B3D6
7 = 0111 B = 1011
Result: 01111011
F = 1111 A = 1010 C = 1100 E = 1110
Result: 1111101011001110
| Mistake | Why It's Wrong | How to Fix It |
|---|---|---|
| Reading division remainders top-to-bottom | The first remainder is the least significant bit | Always read remainders from BOTTOM to TOP |
| Not padding binary groups to 4 bits | Hex 3 = 0011, not 11 | Always use 4 bits per hex digit, pad with leading zeros |
| Grouping binary from left instead of right | Wrong grouping gives wrong answer | Always group from the RIGHT, add leading zeros to left group |
| Forgetting A=10 through F=15 | Hex digits above 9 are letters | Memorise: A=10, B=11, C=12, D=13, E=14, F=15 |
Q1: Convert binary 11001010 to decimal.
Q2: Convert decimal 200 to binary (8 bits).
Q3: Convert hex A5 to decimal.
Q4: Convert binary 111100001010 to hex.
Q5: Convert hex 2F to binary.
β Padding binary with zeros on the wrong side when converting to hex β When grouping binary into 4-bit groups for hex conversion, pad with leading zeros on the LEFT, not trailing zeros on the right.
β Forgetting that hex digits A-F represent 10-15 β A=10, B=11, C=12, D=13, E=14, F=15. These are single hex digits, not two-digit numbers. F is 15, not 16.
β Adding binary without carrying when the column sum exceeds 1 β In binary addition: 0+0=0, 0+1=1, 1+1=10 (0 carry 1), 1+1+1=11 (1 carry 1). You must carry just like in decimal addition.
β Converting binary to hex by converting each bit individually instead of grouping in fours β Group binary into sets of 4 bits from the right, then convert each group to one hex digit. Converting bit-by-bit gives wrong results.
Convert the hexadecimal number 3F to binary and then to decimal. Show all working. [3 marks]
Hex to Binary: 3 = 0011 F = 1111 3F = 00111111 Binary to Decimal: 00111111 0Γ128 + 0Γ64 + 1Γ32 + 1Γ16 + 1Γ8 + 1Γ4 + 1Γ2 + 1Γ1 = 0 + 0 + 32 + 16 + 8 + 4 + 2 + 1 = 63 So 3Fββ = 00111111β = 63ββ
AO1 (Computational Thinking β 40%): Demonstrate knowledge and understanding of the principles and concepts of computer science, including converting between number bases for AQA 8525, OCR J277 & Edexcel 1CP2.
AO2 (Application β 40%): Apply knowledge and understanding of computer science, including converting between number bases to analyse problems in computational terms and to design, write and evaluate solutions.
AO3 (Evaluation β 20%): Evaluate the effectiveness, correctness and efficiency of computational solutions, including converting between number bases, and make reasoned judgements about trade-offs.
Get the best revision books and guides to boost your grades.