Logo
All chapters
Volume II: Digital Logic  ›  Digital Systems & Binary Numbers

Number-Base Conversions

Convert a decimal number into binary, octal, or hex by repeated division.

PrevBinary Numbers
NextOctal & Hexadecimal

Description

A procedure for rewriting the same quantity in another base (2, 8, 10, 16). Humans read decimal/hex easily; machines use binary. Conversion bridges the two worlds. Integer part: divide by the base, keep remainders. Fraction: multiply by the base, keep carries.

  • Divide the number by the target base; record the remainder.
  • Repeat on the quotient until it reaches 0.
  • The answer is the remainders read from last to first.
  • Multiply the fraction by the base and record the integer carry.
  • Repeat on the remaining fraction until it terminates or you have enough digits.
  • What: A procedure for rewriting the same quantity in another base (2, 8, 10, 16).
  • Why: Humans read decimal/hex easily; machines use binary. Conversion bridges the two worlds.
  • How: Integer part: divide by the base, keep remainders. Fraction: multiply by the base, keep carries.
  • Where: Assemblers, debuggers, memory dumps, and any tool that shows machine values to people.
  • When: Any time a value crosses the human↔machine boundary, e.g. typing an address as hex.

At a glance

What

A procedure for rewriting the same quantity in another base (2, 8, 10, 16).

Why

Humans read decimal/hex easily; machines use binary. Conversion bridges the two worlds.

How

Integer part: divide by the base, keep remainders. Fraction: multiply by the base, keep carries.

Where

Assemblers, debuggers, memory dumps, and any tool that shows machine values to people.

When

Any time a value crosses the human↔machine boundary, e.g. typing an address as hex.

Think of it like…

Like making change: you keep pulling out the biggest coin that fits and noting what's left. Repeated division 'pulls out' the next digit each time, and the leftovers (remainders) spell the answer backwards.

Repeated division (integers)

  • Divide the number by the target base; record the remainder.
  • Repeat on the quotient until it reaches 0.
  • The answer is the remainders read from last to first.

Repeated multiplication (fractions)

  • Multiply the fraction by the base and record the integer carry.
  • Repeat on the remaining fraction until it terminates or you have enough digits.

Binary ↔ octal ↔ hex grouping

DecimalBinaryOctal (3-bit)Hex (4-bit)
0000000
5010155
81000108
10101012A
15111117F

Group bits in 3s for octal, 4s for hex — no division needed.

Repeated-division converter

▶ live simulator
stepvalue ÷ 2quotientremainder
1156 ÷ 2780
278 ÷ 2390
339 ÷ 2191
419 ÷ 291
59 ÷ 241
64 ÷ 220
72 ÷ 210
81 ÷ 201

Read remainders bottom-to-top → 10011100

The 5 Whys

  1. 1

    Why convert bases? To move values between human and machine notation.

  2. 2

    Why not just use one base everywhere? Decimal suits people; binary suits circuits.

  3. 3

    Why hex as a middle ground? One hex digit packs exactly four bits.

  4. 4

    Why does grouping work? Powers of the same base align cleanly (8 = 2³, 16 = 2⁴).

  5. 5

    Root cause: base relationships let conversion be mechanical division/grouping, not guesswork.

Cheat sheet

Working principle

  • Integer part: divide by the base, keep remainders. Fraction: multiply by the base, keep carries.
  • A procedure for rewriting the same quantity in another base (2, 8, 10, 16).

Key facts

  • Divide the number by the target base; record the remainder.
  • Multiply the fraction by the base and record the integer carry.

Why it exists

  • Root cause: base relationships let conversion be mechanical division/grouping, not guesswork.
PrevBinary Numbers
NextOctal & Hexadecimal