Base Conversion Formula – Positional Notation & Repeated Division
The general two-step base conversion formula: positional notation (any base to decimal) and repeated division (decimal to any base), with complete variable definitions and three worked examples.
Formula
Converting a number from source base B to target base C uses two formulas in sequence. First, positional notation converts the source to decimal: each digit is multiplied by B raised to its position and the products are summed. Second, the repeated-division algorithm converts that decimal value to base C: divide by C repeatedly, collect remainders, and read them from last to first. Direct bit-grouping shortcuts apply for conversions between binary, octal, and hexadecimal.
Variables
| Symbol | Name | Description | Unit |
|---|---|---|---|
| B | Source base | The radix of the input number — the number of unique digits it uses. Binary: B=2, octal: B=8, decimal: B=10, hex: B=16 | — |
| C | Target base | The radix to convert to. The repeated-division algorithm divides by C at each step until the quotient reaches 0 | — |
| dᵢ | Source digit at pos i | The face value of the digit at position i in base B. Must satisfy 0 ≤ dᵢ < B. For hex source: A=10, B=11, C=12, D=13, E=14, F=15 | — |
| N₁₀ | Decimal intermediate | The decimal value computed in Step 1. This is the bridge between the two bases — it has a unique decimal representation regardless of source or target base | — |
| rₖ | Remainder at step k | One digit of the base-C result. r₀ is the least significant digit; the final remainder is the most significant. For target base 16: rₖ values 10–15 are written as A–F | — |
How to Use
- Step 1 (Source → Decimal): label each source digit's position from 0 (rightmost). Compute N₁₀ = Σ dᵢ × B^i for all positions.
- Step 2 (Decimal → Target): divide N₁₀ by C. Record the remainder r₀. Divide the quotient by C. Record remainder r₁. Continue until the quotient is 0.
- Read all remainders from last to first — this sequence is the result in base C.
- Shortcut for binary ↔ octal: group binary into 3-bit chunks (octal→binary: expand each digit to 3 bits). No decimal step needed.
- Shortcut for binary ↔ hex: group binary into 4-bit chunks (hex→binary: expand each digit to 4 bits). No decimal step needed.
- Shortcut for octal ↔ hex: go via binary — expand octal digits to 3-bit groups to get binary, then regroup into 4-bit hex groups (or vice versa).
Examples
1. Convert (374)₈ to hexadecimal via decimal (two-step method)
Step 1 — (374)₈ to decimal using positional notation:
Step 2 — 252₁₀ to hexadecimal using repeated division by 16:
| Dividend | ÷ 16 | Quotient | Remainder |
|---|---|---|---|
| 252 | ÷ 16 | 15 | C (12) |
| 15 | ÷ 16 | 0 | F (15) |
(374)₈ = (FC)₁₆. Verify: 15×16 + 12 = 252₁₀ ✓
2. Convert (374)₈ to hexadecimal via binary shortcut
Step 1: expand each octal digit to 3 bits — 3=011, 7=111, 4=100 → binary 011111100 (9 bits).
Step 2: pad to 12 bits → 000011111100. Split into 4-bit groups: 0000 | 1111 | 1100.
| 4-bit group | 0000 | 1111 | 1100 |
|---|---|---|---|
| Hex digit | 0 (drop) | F | C |
(374)₈ = (FC)₁₆ — same answer as Example 1, but no division required.
3. Convert (D7E)₁₆ to octal via binary shortcut
Step 1: expand each hex digit to 4 bits — D=1101, 7=0111, E=1110 → binary 110101111110 (12 bits).
Step 2: 12 bits is already a multiple of 3. Split into 3-bit groups: 110 | 101 | 111 | 110.
| 3-bit group | 110 | 101 | 111 | 110 |
|---|---|---|---|---|
| Octal digit | 6 | 5 | 7 | 6 |
(D7E)₁₆ = (6576)₈. Verify: 13×256 + 7×16 + 14 = 3454₁₀. And 6×512 + 5×64 + 7×8 + 6 = 3072+320+56+6 = 3454₁₀ ✓
Related pages
- Use the Calculator — Interactive calculator for this formula
- Read the Notes — Step-by-step explanation with worked examples