Decimal Converter
Decimal (base-10) is the number system we use in everyday life. But computers store data in binary, memory addresses are often shown in hex, and Unix systems use octal for permissions. The repeated-division algorithm converts any decimal integer to any other base in a predictable, easy-to-follow sequence of steps.
Notes
The Repeated Division Algorithm
To convert a decimal number N to base B, divide N by B repeatedly. Each division gives a quotient (carry it forward) and a remainder (save it as one digit of the answer). When the quotient reaches 0, you are done. Read the collected remainders from bottom (last) to top (first) — that sequence is the result in base B.
- Divide N by the target base B. Record the remainder.
- Replace N with the quotient. Divide again. Record the remainder.
- Repeat until the quotient is 0.
- For base 16: if a remainder is 10–15, write it as A–F respectively.
- The final answer is all remainders read from last to first (most significant first).
Converting Decimal to Binary — Example: 89
| 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 |
Converting Decimal to Octal — Example: 255
| Dividend | ÷ 8 | Quotient | Remainder (digit) |
|---|---|---|---|
| 255 | ÷ 8 | 31 | 7 |
| 31 | ÷ 8 | 3 | 7 |
| 3 | ÷ 8 | 0 | 3 |
Converting Decimal to Hexadecimal — Example: 3454
| Dividend | ÷ 16 | Quotient | Remainder (digit) |
|---|---|---|---|
| 3454 | ÷ 16 | 215 | 14 → E |
| 215 | ÷ 16 | 13 | 7 |
| 13 | ÷ 16 | 0 | 13 → D |
Why Remainders Are Read in Reverse
The first remainder you get is the least significant digit (lowest power of the base). The last remainder is the most significant digit. Reading bottom-to-top reverses the order so the most significant digit appears first, matching standard positional notation.
- How Decimal Conversion Works — Detailed Notes — Repeated division explained in depth with more examples
- Decimal Conversion Formula Reference — Division algorithm formula, variables, and worked examples
Frequently Asked Questions
Does this work for any decimal integer?
Yes — the repeated-division algorithm works for any positive integer. For zero, the result is 0 in every base. Negative numbers require a sign or a representation like two's complement (not covered here).
How do I convert a decimal fraction like 0.75 to binary?
For fractional parts, use repeated multiplication instead of division: multiply by 2, save the integer part (0 or 1) as the next binary digit, and repeat with the fractional remainder. For 0.75: 0.75×2=1.5 (digit 1), 0.5×2=1.0 (digit 1) → 0.75₁₀ = 0.11₂.
Is there a shortcut from decimal to hexadecimal?
For small numbers (0–255), you can convert to binary first (8 bits) and then split into two 4-bit groups, each mapping to one hex digit. For example, 89₁₀ = 01011001₂ → 0101 | 1001 → 5 | 9 → 59₁₆. The repeated-division method is more general.
How does the calculator handle hex remainders 10–15?
When dividing by 16, remainders 10 through 15 are written as hex letters: 10=A, 11=B, 12=C, 13=D, 14=E, 15=F. The step-by-step table shows both the numeric value and the letter so you can follow along.