AdvancedQuantitative Aptitude · Lesson 37 of 38 · Updated ·
Number Bases — Binary, Octal, Hexadecimal and Conversions
We write numbers in base 10 (decimal) because we have ten fingers: ten digits, 0 to 9, and each place is worth ten times the place to its right. Computers use base 2 (binary), because a circuit is either off (0) or on (1). Programmers also use base 8 (octal) and base 16 (hexadecimal, or hex) as short ways to write long binary numbers.
Number-base questions appear in AMCAT, TCS-style numerical sections, CoCubes papers and in the first chapter of computer organisation (COA) and digital-electronics courses. They are pure method — once you know it, they are free marks.
1. Place value in any base
In base b, the digits are 0 to b − 1, and the places are worth 1, b, b², b³, … from the right. A small subscript shows the base: 1011₂ means "1011 in base 2".
Value = (last digit × 1) + (next digit × b) + (next × b²) + …
Example 1
Convert 101101₂, 237₈ and 2F₁₆ to decimal.
- 101101₂ = 32 + 0 + 8 + 4 + 0 + 1 = 45.
- 237₈ = 2 × 64 + 3 × 8 + 7 = 128 + 24 + 7 = 159.
- 2F₁₆ = 2 × 16 + 15 = 47. (In hex, A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.)
| Base | Name | Digits | Place values |
|---|---|---|---|
| 2 | binary | 0, 1 | 1, 2, 4, 8, 16, 32, 64, 128 … |
| 8 | octal | 0–7 | 1, 8, 64, 512 … |
| 10 | decimal | 0–9 | 1, 10, 100, 1000 … |
| 16 | hexadecimal | 0–9, A–F | 1, 16, 256, 4096 … |
Learn the powers of 2 up to 2¹⁰ = 1024. They make binary questions instant.
2. Decimal to any base: repeated division
To write a decimal number in base b, divide by b again and again and note the remainders. Stop when the quotient is 0. Then read the remainders from the bottom up.
Why it works: the first remainder is what is left over after taking out all the b's — that is exactly the units digit. Dividing the quotient again finds the next digit, and so on.
Example 2
Convert 100 to binary, octal and hex.
- Binary: 100 = 64 + 32 + 4 → 1100100₂. (Subtracting the largest power of 2 each time is faster than dividing for small numbers.)
- Octal: 100 ÷ 8 = 12 r 4; 12 ÷ 8 = 1 r 4; 1 ÷ 8 = 0 r 1 → 144₈.
- Hex: 100 ÷ 16 = 6 r 4 → 64₁₆.
3. Binary ↔ octal and hex: grouping
Because 8 = 2³ and 16 = 2⁴, every octal digit is exactly 3 binary digits and every hex digit is exactly 4 binary digits. So you do not need decimal at all.
- Binary → hex: split into groups of 4 from the right, convert each group.
- Binary → octal: split into groups of 3 from the right. Pad the leftmost group with 0s if needed.
- Hex or octal → binary: write each digit as 4 (or 3) bits.
Example 3
Convert 3A₁₆ to binary and to octal.
3 = 0011, A = 1010 → 0011 1010 → 111010₂. Group in threes: 111 010 → 72₈. Check: 3A₁₆ = 3 × 16 + 10 = 58, and 72₈ = 7 × 8 + 2 = 58. ✓
4. Adding in another base
Add column by column as usual, but carry when you reach b, not 10.
Example 4
Add 1101₂ + 111₂.
1 1 0 1
+ 1 1 1
---------
1 0 1 0 0
From the right: 1 + 1 = 2 = "10" → write 0, carry 1. 0 + 1 + 1 = 2 → 0, carry 1. 1 + 1 + 1 = 3 = "11" → 1, carry 1. 1 + 1 = 2 → 0, carry 1. Answer 10100₂. Check in decimal: 13 + 7 = 20 = 16 + 4 = 10100₂. ✓
5. "Find the base" questions
These look hard but turn into a one-line equation.
Example 5
In which base is 13 + 15 = 31 true?
Write each number with an unknown base b: (b + 3) + (b + 5) = 3b + 1 → 2b + 8 = 3b + 1 → b = 7. Check: 13₇ = 10, 15₇ = 12, and 31₇ = 22. 10 + 12 = 22. ✓
Also remember: the base must be bigger than every digit used. In this question the digit 5 appears, so b ≥ 6 anyway.
6. Useful facts for quick questions
- The largest n-digit number in base b is bⁿ − 1. Largest 3-digit octal number: 777₈ = 8³ − 1 = 511.
- An n-bit binary number can represent 2ⁿ values (0 to 2ⁿ − 1). 8 bits → 256 values (0 to 255 = FF₁₆).
- Multiplying by b in base b just adds a 0 at the end, like ×10 in decimal: 101₂ × 2 = 1010₂.
- A binary number is even if and only if its last bit is 0.
- Number of binary digits of N = (the power of 2 just above N, counted as an exponent). 1000 needs 10 bits, because 2⁹ = 512 ≤ 1000 < 1024 = 2¹⁰.
Common mistakes
- Reading the remainders top to bottom. The last remainder is the first (leftmost) digit.
- Grouping binary digits from the left. Always group from the right, then pad the left group.
- Using a digit that is not allowed: "8" cannot appear in octal, and "2" cannot appear in binary.
- Treating hex letters as separate digits — A is a single digit worth 10.
- In "find the base" questions, forgetting to check that the base is bigger than every digit.
Quick recap
- Base b: digits 0 to b − 1; place values 1, b, b², b³ …
- To decimal: multiply each digit by its place value and add.
- From decimal: divide by b repeatedly, read remainders bottom-up.
- Binary ↔ octal: groups of 3 bits. Binary ↔ hex: groups of 4 bits. Group from the right.
- In base b, carry when a column reaches b.
- Largest n-digit number in base b = bⁿ − 1; n bits give 2ⁿ values.