Decimal Conversion Formula – Repeated Division Algorithm
The repeated-division formula for converting decimal integers to binary, octal, or hexadecimal, with complete variable definitions, procedure steps, and three worked examples including hex letter remainders.
Formula
To convert a decimal integer N to base B, repeatedly divide N by B. The remainder at each step is one digit of the result (least significant first). Continue until the quotient reaches 0, then read all collected remainders from last to first — that sequence is the number expressed in base B. For base 16, replace any remainder 10–15 with its letter (A–F).
Variables
| Symbol | Name | Description | Unit |
|---|---|---|---|
| N | Decimal input | The positive integer to convert — starts as the original number and is replaced by the quotient at each step until it reaches 0 | — |
| B | Target base | The number system to convert to: 2 for binary, 8 for octal, 16 for hexadecimal. Must be an integer ≥ 2 | — |
| qₖ | Quotient at step k | The integer part of dividing the previous value by B: qₖ = ⌊qₖ₋₁ / B⌋. This becomes the input to the next division step | — |
| rₖ | Remainder at step k | One digit of the output: rₖ = qₖ₋₁ mod B. The first remainder r₀ is the least significant digit; the last remainder is the most significant digit | — |
How to Use
- Divide N by the target base B. Record the remainder r₀ (least significant digit) and quotient q₁.
- Divide q₁ by B. Record the remainder r₁ and quotient q₂.
- Continue dividing each successive quotient by B, recording the remainder at each step.
- Stop when the quotient is 0. The last remainder recorded is the most significant digit.
- The result is all collected remainders read from last to first (most-significant first).
- For base 16: replace remainders 10→A, 11→B, 12→C, 13→D, 14→E, 15→F.
Examples
1. Convert 89₁₀ to binary (divide by 2)
| Dividend | ÷ 2 | Quotient | Remainder (bit) |
|---|---|---|---|
| 89 | ÷ 2 | 44 | 1 |
| 44 | ÷ 2 | 22 | 0 |
| 22 | ÷ 2 | 11 | 0 |
| 11 | ÷ 2 | 5 | 1 |
| 5 | ÷ 2 | 2 | 1 |
| 2 | ÷ 2 | 1 | 0 |
| 1 | ÷ 2 | 0 | 1 |
Read remainders bottom to top: 1,0,1,1,0,0,1 → (89)₁₀ = (1011001)₂. Verify: 64+16+8+1 = 89₁₀ ✓
2. Convert 255₁₀ to octal (divide by 8)
| Dividend | ÷ 8 | Quotient | Remainder (digit) |
|---|---|---|---|
| 255 | ÷ 8 | 31 | 7 |
| 31 | ÷ 8 | 3 | 7 |
| 3 | ÷ 8 | 0 | 3 |
Read bottom to top: 3,7,7 → (255)₁₀ = (377)₈. Verify: 3×64 + 7×8 + 7 = 192+56+7 = 255₁₀ ✓
3. Convert 3454₁₀ to hexadecimal (divide by 16)
| Dividend | ÷ 16 | Quotient | Remainder (digit) |
|---|---|---|---|
| 3454 | ÷ 16 | 215 | 14 → E |
| 215 | ÷ 16 | 13 | 7 |
| 13 | ÷ 16 | 0 | 13 → D |
Read bottom to top: D, 7, E → (3454)₁₀ = (D7E)₁₆. Verify: 13×256 + 7×16 + 14 = 3328+112+14 = 3454₁₀ ✓
Related pages
- Use the Calculator — Interactive calculator for this formula
- Read the Notes — Step-by-step explanation with worked examples