Number System Conversions — Binary, Decimal and Hexadecimal
Every number system works the same way: each position is worth the base raised to a power. Decimal uses ten symbols, binary two, hexadecimal sixteen. Once that single idea is clear, the conversions are mechanical. This guide gives the two methods you need — repeated division and positional expansion — plus the grouping trick that makes binary-to-hexadecimal almost instant, and the fraction case that most students never see until it bites them.
The idea behind every base
Decimal 3407 means (3 × 10³) + (4 × 10²) + (0 × 10¹) + (7 × 10⁰). Binary 1011 means (1 × 2³) + (0 × 2²) + (1 × 2¹) + (1 × 2⁰) = 8 + 0 + 2 + 1 = 11. Nothing else is going on.
| System | Base | Digits used | Where you meet it |
|---|---|---|---|
| Binary | 2 | 0, 1 | Digital logic; how all data is actually stored |
| Octal | 8 | 0 to 7 | File permissions in Unix and Linux |
| Decimal | 10 | 0 to 9 | Everyday arithmetic |
| Hexadecimal | 16 | 0 to 9, then A to F | Colour codes, memory addresses, error codes |
Hex letters carry ordinary values: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15. Hex exists purely as shorthand for binary — one hex digit stands for exactly four bits, so a 32-bit address fits in eight characters instead of thirty-two.
Method 1 — decimal to any base, by repeated division
Worked example 1 — convert 156 to binary
156 ÷ 2 = 78 remainder 0
78 ÷ 2 = 39 remainder 0
39 ÷ 2 = 19 remainder 1
19 ÷ 2 = 9 remainder 1
9 ÷ 2 = 4 remainder 1
4 ÷ 2 = 2 remainder 0
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1
Reading upward: 156 = 10011100 in binary
Check by positional expansion: 128 + 0 + 0 + 16 + 8 + 4 + 0 + 0 = 156 ✓
Always run that check. It takes ten seconds and catches the single most common error in the whole topic, which is reading the remainders downward.
Method 2 — binary to hexadecimal, by grouping
Worked example 2 — 10011100 to hexadecimal
Split: 1001 | 1100
1001 = 8 + 0 + 0 + 1 = 9
1100 = 8 + 4 + 0 + 0 = 12 = C
So 10011100 = 9C in hexadecimal.
Check against decimal: (9 × 16) + 12 = 144 + 12 = 156 ✓ — the same number we started with in example 1.
For octal the trick is identical with groups of three bits, because 8 = 2³. 10011100 groups as 10 | 011 | 100 = 2, 3, 4, so it is 234 in octal. Check: (2 × 64) + (3 × 8) + 4 = 128 + 24 + 4 = 156 ✓
Worked example 3 — hexadecimal to decimal and binary
Convert 2F5 (hex) to decimal.
Positions from the right are 16⁰ = 1, 16¹ = 16, 16² = 256.
2 × 256 = 512
F × 16 = 15 × 16 = 240
5 × 1 = 5
Total = 512 + 240 + 5 = 757
To binary, expand each hex digit into four bits:
2 → 0010, F → 1111, 5 → 0101
2F5 = 0010 1111 0101, or 1011110101 with the leading zeros dropped.
Check: 512 + 128 + 64 + 32 + 16 + 4 + 1 = 757 ✓
Note how much easier hex-to-binary is than decimal-to-binary. That is the entire reason programmers write memory addresses and colour codes in hex.
Worked example 4 — fractions
Convert 0.625 to binary.
0.625 × 2 = 1.25 → digit 1, carry 0.25
0.25 × 2 = 0.5 → digit 0, carry 0.5
0.5 × 2 = 1.0 → digit 1, carry 0 — stop
Reading downward: 0.625 = 0.101 in binary
Check: 0.5 + 0 + 0.125 = 0.625 ✓
Why 0.1 cannot be stored exactly
Try the same method on 0.1 and it never terminates:
0.1 × 2 = 0.2 → 0
0.2 × 2 = 0.4 → 0
0.4 × 2 = 0.8 → 0
0.8 × 2 = 1.6 → 1, carry 0.6
0.6 × 2 = 1.2 → 1, carry 0.2 — and we are back at 0.2, so the block 0011 repeats forever.
0.1 = 0.0001100110011… in binary, a recurring expansion.
A computer stores a fixed number of bits, so it keeps a rounded version. This is why 0.1 + 0.2 does not always print as exactly 0.3 in a programming language, and why financial software stores money in paise as whole numbers rather than in rupees as decimals. A fraction terminates in base b only if its denominator's prime factors all divide b — so in binary only halves, quarters, eighths and so on terminate. One-tenth has a factor of 5, and 5 does not divide 2.
Quick reference table
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 5 | 0101 | 5 | 5 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 156 | 10011100 | 234 | 9C |
| 205 | 11001101 | 315 | CD |
| 255 | 11111111 | 377 | FF |
255 = FF = 11111111 is worth memorising: it is the largest value one byte of eight bits can hold, which is why colour channels run 0 to 255 and why #FFFFFF is white.
Common mistakes
- Reading the remainders downward. The first remainder is the least significant digit, so it goes on the right. Read upward.
- Grouping bits from the left. Group from the right and pad the left, or every digit shifts.
- Forgetting the hex letters. After 9 comes A, not 10.
- Reading binary 10 as "ten". It is two. Say the digits: "one zero".
- Multiplying instead of dividing for the integer part, or dividing instead of multiplying for the fraction. Integer part divides; fraction multiplies.
- Confusing bit and byte. 8 bits = 1 byte, and one hex digit = 4 bits = half a byte.
- Not checking the answer. Positional expansion converts back in seconds; there is no excuse for an unchecked conversion.
Where this appears
| Context | Use |
|---|---|
| School computer science (Class 9–12) | Number systems chapter; data representation; character encoding |
| Digital electronics | Logic gates, registers, binary arithmetic, two's complement |
| GATE (CS and allied papers) | Number representation, floating point, precision loss |
| Everyday technical work | Hex colour codes, IP and MAC addresses, file permissions, error codes |
It reaches science students too. Instrument data files, spectrometer output and image formats are all binary underneath, and the rounding behaviour explained above is exactly why a long numerical simulation can drift from the analytical answer.
Check a conversion in one step. The Converters and Everyday section of the calculator suite includes a numeral-system tool that converts between binary, octal, decimal and hexadecimal, so you can verify every example on this page.
Open the ABC Chemistry Calculator Suite →Positional notation is the same idea that powers scientific notation in chemistry and physics. ABC Chemistry runs Class 11–12 chemistry coaching at its Gurugram centre plus online classes across India — abcchemistry.in.