Return to Home Page       Return to Instructional Calendar

Cheat-Sheet & How-To

Conversions Between Decimal, Binary, Octal, and Hexadecimal

Learn the core methods: repeated division (to convert to another base), positional weights (to convert from a base to decimal), and quick groupings using binary as a bridge (for octal/hex).

Notation & Place Value

A number in base b with digits \(d_k \dots d_2 d_1 d_0\) has value:

value = dk·bk + … + d2·b2 + d1·b1 + d0·b0

Common bases: Binary (2) digits 0–1, Octal (8) digits 0–7, Decimal (10) digits 0–9, Hex (16) digits 0–9 + A–F (A=10, …, F=16).

Power Base 2 Base 8 Base 10 Base 16
0 1 1 1 1
1 2 8 10 16
2 4 64 100 256
3 8 512 1,000 4,096
4 16 4,096 10,000 65,536

Convert Any Base → Decimal (Positional Weights)

Algorithm

  1. Write place values \(b^0, b^1, b^2, …\) from right to left.
  2. Multiply each digit by its place value.
  3. Add the products to get the decimal value.

Examples

Binary → Decimal: 101101₂ = 1·32 + 0·16 + 1·8 + 1·4 + 0·2 + 1·1 = 45₁₀

Octal → Decimal: 531₈ = 5·64 + 3·8 + 1 = 345₁₀

Hex → Decimal: ABC₁₆ = A·256 + B·16 + C = 10·256 + 11·16 + 12 = 2748₁₀

Convert Decimal → Other Bases (Repeated Division)

Algorithm

  1. Divide the decimal number by the target base.
  2. Record the remainder (0–b−1).
  3. Use the quotient for the next division; repeat until the quotient is 0.
  4. Read remainders from last to first (bottom → top) to get the digits.

Examples

Decimal → Binary (2): 45 ÷2 → remainders: 1,0,1,1,0,1 → read up = 101101₂

Decimal → Octal (8): 345 ÷8 → r: 1,3,5 → up = 531₈

Decimal → Hex (16): 2748 ÷16 → r: C(12), B(11), A(10) → up = ABC₁₆

Convert Between Octal/Hex Using Binary as a Bridge

Binary ↔ Octal (group 3 bits)

  • Binary → Octal: group bits in sets of 3 from the right; pad the left with zeros if needed. Convert each 3-bit group to one octal digit.
  • Octal → Binary: convert each octal digit to its 3-bit binary value (0→000, …, 7→111) and concatenate.

Binary → Octal: 110101101₂ → groups: 110 101 101 → 655₈

Octal → Binary: 655₈ → 6→110, 5→101, 5→101 → 110101101₂

Binary ↔ Hex (group 4 bits)

  • Binary → Hex: group bits in sets of 4 from the right; pad the left with zeros if needed. Convert each 4-bit group to one hex digit (0–F).
  • Hex → Binary: convert each hex digit to its 4-bit binary value (A→1010, …, F→1111) and concatenate.

Binary → Hex: 110101111001₂ → groups: 1101 0111 1001 → D 7 9 → D79₁₆

Hex → Binary: ABC₁₆ → A→1010, B→1011, C→1100 → 101010111100₂

Hex ↔ Octal (via Binary)

Hex → Octal: ABC₁₆ → binary 101010111100 → group by 3: 101 010 111 100 → 5 2 7 4 → 5274₈

Check: 2748₁₀ ↔ ABC₁₆ ↔ 5274₈ (all equal).

Quick Maps (Handy Lookups)

3-Bit ↔ Octal

Binary Octal Binary Octal Binary Octal
000 0 001 1 010 2
011 3 100 4 101 5
110 6 111 7

4-Bit ↔ Hex

Binary Hex Binary Hex Binary Hex Binary Hex
0000 0 0001 1 0010 2 0011 3
0100 4 0101 5 0110 6 0111 7
1000 8 1001 9 1010 A 1011 B
1100 C 1101 D 1110 E 1111 F

0–15 Cross-Reference

Decimal Binary Octal Hex
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F

Tips, Checks & Edge Cases

```