Number Systems and Conversions: Decimal, Binary, Octal, and Hexadecimal
What is a Number System? (In Simple Words)
In daily life, we count things using 10 digits: 0 to 9. We call this the Decimal System. Why 10? Because humans naturally started counting on their 10 fingers!
Computers do not have fingers. A computer is built using millions of tiny electronic switches called transistors.
- An electronic switch has only two states: OFF (0 Volt) or ON (+5 Volts).
- Because of this, computers work only with two digits: 0 and 1.
- This 2-digit system is called the Binary System.
Binary numbers can get very long and confusing for humans. So, computer scientists group binary bits into Octal (base 8) and Hexadecimal (base 16) to read them easily.
💡 Real-Life Indian Student Analogy:
Think of carrying ₹1,000 cash in your pocket:
- Carrying one thousand ₹1 coins is heavy and confusing (like Binary
1111101000).- Carrying ₹10 notes is much easier to count (like Octal).
- Carrying two ₹500 notes is the cleanest and fastest to handle (like Hexadecimal).
The total amount of money is the exact same. Only the way we group it changes!
1. The Four Primary Number Systems
Every number system has a Base (also called Radix).
- Base (Radix): The total number of unique digits used in that number system.
Used by humans in daily life
Directly understood by computer hardware
1 Octal digit = Group of 3 binary bits
1 Hex digit = Group of 4 binary bits
Quick Comparison Table
| System | Base (Radix) | Allowed Digits / Symbols | Positional Weights Example | Example |
|---|---|---|---|---|
| Binary | 2 | 0, 1 |
2³, 2², 2¹, 2⁰ (values: 8, 4, 2, 1) | (1101)₂ |
| Octal | 8 | 0, 1, 2, 3, 4, 5, 6, 7 |
8², 8¹, 8⁰ (values: 64, 8, 1) | (75)₈ |
| Decimal | 10 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 |
10², 10¹, 10⁰ (values: 100, 10, 1) | (25)₁₀ |
| Hexadecimal | 16 | 0–9, A, B, C, D, E, F |
16², 16¹, 16⁰ (values: 256, 16, 1) | (1F)₁₆ |
Remember in Hexadecimal:
A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
2. Step-by-Step Number System Conversions
Case A: Converting from Decimal to Any Other Base
The Golden Rules:
- For the whole number part: Keep dividing by the new base. Write down the remainder each time. Read the remainders from bottom to top (MSB to LSB).
- For the decimal point part: Keep multiplying by the new base. Note down the integer part. Read the integers from top to bottom.
Example 1: Convert (25)₁₀ to Binary (Base 2)
- 25 ÷ 2 = 12, remainder is 1 (LSB - Last digit)
- 12 ÷ 2 = 6, remainder is 0
- 6 ÷ 2 = 3, remainder is 0
- 3 ÷ 2 = 1, remainder is 1
- 1 ÷ 2 = 0, remainder is 1 (MSB - First digit)
- Now read remainders from bottom to top: (11001)₂
Example 2: Convert (125)₁₀ to Octal (Base 8)
- 125 ÷ 8 = 15, remainder is 5 (LSB)
- 15 ÷ 8 = 1, remainder is 7
- 1 ÷ 8 = 0, remainder is 1 (MSB)
- Read bottom to top: (175)₈
Example 3: Convert (250)₁₀ to Hexadecimal (Base 16)
- 250 ÷ 16 = 15, remainder is 10 (In Hex, 10 is written as A)
- 15 ÷ 16 = 0, remainder is 15 (In Hex, 15 is written as F)
- Read bottom to top: (FA)₁₆
Case B: Converting from Any Base to Decimal
The Golden Rule: Multiply each digit by its positional weight (Base⁰, Base¹, Base², … from right to left) and add all the values together.
Example 4: Convert (1101.101)₂ to Decimal
- Work from the point:
- Left of point: (1 × 2³) + (1 × 2²) + (0 × 2¹) + (1 × 2⁰) = 8 + 4 + 0 + 1 = 13
- Right of point: (1 × 2⁻¹) + (0 × 2⁻²) + (1 × 2⁻³) = 0.5 + 0 + 0.125 = 0.625
- Final answer: (13.625)₁₀
Example 5: Convert (2A3)₁₆ to Decimal
- Put the values: (2 × 16²) + (A × 16¹) + (3 × 16⁰) = (2 × 256) + (10 × 16) + (3 × 1) = 512 + 160 + 3 = (675)₁₀
Case C: Fast Grouping Method (Binary ↔ Octal & Hexadecimal)
You do not need to convert to decimal first! Because 2³ = 8 and 2⁴ = 16, we can directly bundle the bits.
↔ Group of 3 Bits
The Central Bridge
↔ Group of 4 Bits
1. Binary to Octal:
- Make groups of 3 bits starting from right to left.
- Convert
(11010111)₂to Octal:- Pad a zero on left:
011 010 111 011= 3,010= 2,111= 7- Answer = (327)₈
- Pad a zero on left:
2. Binary to Hexadecimal:
- Make groups of 4 bits starting from right to left.
- Convert
(11010111)₂to Hex:- Group:
1101 0111 1101= 13 = D,0111= 7- Answer = (D7)₁₆
- Group:
3. Octal to Hexadecimal:
- First, convert each octal digit into 3 binary bits.
- Then, regroup those binary bits into sets of 4 bits from right to left.
- Convert
(725)₈to Hex:- Octal to Binary:
7→111,2→010,5→101(Together:111010101) - Regroup into 4 bits:
0001 1101 0101 0001= 1,1101= D,0101= 5- Answer = (1D5)₁₆
- Octal to Binary:
💡 DAVV Exam Preparation Tips
5-Mark Question: “Convert (458)₁₀ into Binary, Octal, and Hexadecimal.”
- Show the step-by-step division for each base clearly.
- Write remainders in a clear right-side column with an upward arrow (LSB to MSB).
- Highlight your final answers:
- (458)₁₀ = (111001010)₂
- (458)₁₀ = (712)₈
- (458)₁₀ = (1CA)₁₆
10-Mark Question: “Explain the four primary computer number systems. What is radix? Explain with examples how to convert Hexadecimal numbers into Binary and Octal.”
- Define Radix / Base: total symbols used in a number system.
- List all 4 systems with their bases and valid symbols.
- Draw the standard 4-bit binary table for 0 to 15 (0000 to 1111).
- Solve two clear examples, including a fractional value like (2B.4E)₁₆.