1. Number system
IGCSE Computer Science (0478)
  • Data Representation
    • Introduction
    • Why computers use binary (how binary represents data)
    • Number system
      • Introduction
      • Number Conversions
      • Addition of Binary Numbers
      • Logical binary shifts (positive 8-bit integers)
      • Two’s Complement (Signed: Positive and Negative Numbers)
      • Use of the Hexadecimal System
    • Text, Sound and Image
      • Text, Sound and Images
      • File Types
    • Data storage and File compression
      • Measurement of the Size of Computer Memories
      • Lossless and Lossy File Compression
  1. Number system

Number Conversions

Absolutely! Here’s a clear explanation that first covers the logic behind each type of conversion, then follows with examples. It’s simple, step-by-step, and easy to understand:

Number Conversions: Logic and Examples#


1. Converting Binary to Denary (Decimal)#

Logic:
Each digit in a binary number represents a power of 2, starting from 20=1 at the rightmost bit.
To find the decimal value, multiply each binary digit by its corresponding power of 2.
Add up all the values where the binary digit is 1.
Example: Convert 11101110 to decimal
Place Value (powers of 2)1286432168421
Binary Digit11101110
Add the place values with 1s:
128 + 64 + 32 + 8 + 4 + 2 = 238

2. Converting Denary to Binary#

Logic:
Divide the decimal number by 2 repeatedly.
At each division, note the remainder (0 or 1).
Continue until the quotient is 0.
The binary number is the remainders read from bottom to top.
Example: Convert 142 to binary
Divide by 2QuotientRemainder
142 ÷ 2710
71 ÷ 2351
35 ÷ 2171
17 ÷ 281
8 ÷ 240
4 ÷ 220
2 ÷ 210
1 ÷ 201
Read remainders bottom to top → 10001110

3. Converting Hexadecimal to Binary#

Logic:
Each hex digit represents a value from 0 to 15.
Convert each hex digit to its 4-bit binary equivalent.
Join all these binary groups together for the full binary number.
Example: Convert 21FD (hex) to binary
Hex Digit21FD
Decimal211513
Binary0010000111111101
Final binary: 0010000111111101

4. Converting Binary to Hexadecimal#

Logic:
Split the binary number into groups of 4 bits, starting from the right.
Add zeros on the left if the first group has less than 4 bits.
Convert each 4-bit group to decimal, then to hex (0–9 or A–F).
Example: Convert 1000011111101 to hex
Binary Group0010000111111101
Decimal211513
Hex21FD
Final hex: 21FD

5. Converting Hexadecimal to Denary#

Logic:
Convert hex to binary (as in step 3).
Convert that binary number to decimal (as in step 1).

6. Converting Denary to Hexadecimal#

Logic:
Convert decimal to binary (as in step 2).
Convert binary to hex (as in step 4).

Sure! Here are detailed step-by-step solutions for each practice question:

Practice Questions & Worked Examples#

1. Binary to Denary (Decimal)#

Question: Convert binary 10110101 to decimal.
Step 1: Write place values (powers of 2):
1286432168421
10110101
Step 2: Add place values where bit = 1:
128 + 32 + 16 + 4 + 1 = 181

2. Denary to Binary#

Question: Convert decimal 78 to binary.
Step 1: Divide by 2 repeatedly, write remainders:
Divide by 2QuotientRemainder
78 ÷ 2390
39 ÷ 2191
19 ÷ 291
9 ÷ 241
4 ÷ 220
2 ÷ 210
1 ÷ 201
Step 2: Read remainders from bottom to top → 1001110

3. Hexadecimal to Binary#

Question: Convert hex 3A9F to binary.
Hex Digit3A9F
Decimal310915
Binary0011101010011111
Final binary: 0011101010011111

4. Binary to Hexadecimal#

Question: Convert binary 11011100101 to hexadecimal.
Step 1: Group bits into 4 from right (add leading zeros if needed):
Binary: 0001 1011 1001 0101
Group0001101110010101
Decimal11195
Hex1B95
Final hex: 1B95

5. Hexadecimal to Denary#

Question: Convert hex 4B7 to decimal.
Step 1: Convert each hex digit to binary:
Hex Digit4B7
Decimal4117
Binary010010110111
Binary number: 010010110111
Step 2: Convert binary to decimal:
Place Value204810245122561286432168421
Binary Digit010010110111
Add values with 1: 1024 + 128 + 32 + 16 + 4 + 2 + 1 = 1207

6. Denary to Hexadecimal#

Question: Convert decimal 255 to hexadecimal.
Step 1: Convert 255 to binary:
Divide by 2QuotientRemainder
255 ÷ 21271
127 ÷ 2631
63 ÷ 2311
31 ÷ 2151
15 ÷ 271
7 ÷ 231
3 ÷ 211
1 ÷ 201
Binary: 11111111
Step 2: Group binary into 4 bits:
1111 1111
Group11111111
Dec1515
HexFF
Final hex: FF
Modified at 2025-08-11 06:25:09
Previous
Introduction
Next
Addition of Binary Numbers
Built with