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).

PowerBase 2Base 8Base 10Base 16
01111
1281016
2464100256
385121,0004,096
4164,09610,00065,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

BinaryOctalBinaryOctalBinaryOctal
000000110102
011310041015
11061117

4-Bit ↔ Hex

BinaryHexBinaryHexBinaryHexBinaryHex
00000000110010200113
01004010150110601117
10008100191010A1011B
1100C1101D1110E1111F

0–15 Cross-Reference

DecimalBinaryOctalHex
0000000
1000111
2001022
3001133
4010044
5010155
6011066
7011177
81000108
91001119
10101012A
11101113B
12110014C
13110115D
14111016E
15111117F

Tips, Checks & Edge Cases

```