How to Convert Between Number Bases

All number systems share one underlying idea: positional notation — each digit's contribution depends on its position. The only thing that changes from one system to another is the base, which determines how quickly positional values grow. Converting between any two bases always decomposes into the same two-step process: read the source number's value (using positional notation to convert to decimal), then express that value in the target base (using the repeated-division algorithm). For binary, octal, and hexadecimal, direct bit-grouping shortcuts let you skip the decimal step entirely — making those conversions near-instantaneous.

The Four Standard Number Systems

SystemBaseDigits used1 digit represents
Binary20, 11 bit
Octal80–73 bits (since 2³ = 8)
Decimal100–9not a power of 2
Hexadecimal160–9, A–F4 bits (since 2⁴ = 16)

Binary is the fundamental language of digital hardware. Octal and hexadecimal are compact shorthand for binary — each octal digit is exactly 3 bits, each hex digit exactly 4 bits. Decimal is what humans naturally use, but it is not a power of 2, so converting to/from decimal always requires arithmetic rather than simple substitution.

The General Two-Step Conversion Method

To convert a number from any base B to any base C, use these two steps:

  1. Step 1 — Source → Decimal (Positional Notation): multiply each digit by B raised to its position (rightmost = position 0) and sum all products. For hex digits A–F, substitute the values 10–15.
  2. Step 2 — Decimal → Target (Repeated Division): divide the decimal value by C repeatedly, recording each remainder. Read all remainders from last to first — that sequence is the result in base C.

Worked Example 1 — Convert (374)₈ to Hexadecimal (via Decimal)

Step 1: Convert octal (374)₈ to decimal using positional notation.

Step 2: Convert 252₁₀ to hexadecimal using repeated division by 16.

Dividend÷ 16QuotientRemainder (digit)
252÷ 1615C (12) ← least significant digit
15÷ 160F (15) ← most significant digit
Read bottom to top: F, C → (374)₈ = (FC)₁₆. Verify: 15×16 + 12 = 240+12 = 252₁₀ ✓

Shortcut Conversions — Skip the Decimal Step

When both the source and target base are powers of 2 (binary, octal, hex), you can skip the decimal intermediate entirely. These shortcuts work because 2³ = 8 and 2⁴ = 16 — each octal digit is exactly 3 bits, and each hex digit is exactly 4 bits.

ConversionShortcut methodSpeed
Binary → OctalGroup binary into 3-bit chunks from right; each chunk → 1 octal digitVery fast
Binary → HexGroup binary into 4-bit chunks from right; each chunk → 1 hex digitVery fast
Octal → BinaryReplace each octal digit with its 3-bit binary equivalentVery fast
Hex → BinaryReplace each hex digit with its 4-bit binary equivalentVery fast
Octal ↔ HexGo via binary: octal→binary→hex or hex→binary→octalFast
Any other pairTwo-step via decimal (positional notation + repeated division)Always works

Worked Example 2 — Convert (374)₈ to Hexadecimal (Shortcut via Binary)

The same conversion as Example 1 but using the binary shortcut — demonstrating that both methods give the same answer.

Step 1: Expand each octal digit to 3 bits → 3=011, 7=111, 4=100 → binary string 011 111 100.

Step 2: Regroup into 4-bit chunks from right (pad left if needed) → 0 1111 1100 → 0000 1111 1100.

4-bit group000011111100
Hex digit0 (drop)FC
(374)₈ = (FC)₁₆ — same result as via-decimal, but no division required. The binary bridge connects them directly.

Worked Example 3 — Convert (D7E)₁₆ to Octal

Step 1: Expand each hex digit to 4 bits → D=1101, 7=0111, E=1110 → binary 1101 0111 1110.

Step 2: The 12-bit string is already a multiple of 3, so regroup directly into 3-bit chunks: 110 | 101 | 111 | 110.

3-bit group110101111110
Octal digit6576
(D7E)₁₆ = (6576)₈. Verify via decimal: 13×256 + 7×16 + 14 = 3328+112+14 = 3454₁₀. And 6×512 + 5×64 + 7×8 + 6 = 3072+320+56+6 = 3454₁₀ ✓

Summary — Which Method to Choose

From / ToBinaryOctalDecimalHex
Binary3-bit groupsPositional sum4-bit groups
Octal3-bit expandPositional sumVia binary
DecimalDiv ÷ 2Div ÷ 8Div ÷ 16
Hex4-bit expandVia binaryPositional sum

Frequently Asked Questions

Is there a direct method to convert between any two bases without going through decimal?

For binary, octal, and hex — yes. The bit-grouping shortcuts (3-bit for octal, 4-bit for hex) let you convert directly without any arithmetic. For conversions involving decimal or other bases, the two-step via-decimal method is the universal approach. It always works, regardless of which two bases you're converting between.

Why are octal and hex more useful than decimal for working with binary?

Because they are both powers of 2 (8=2³, 16=2⁴), each octal or hex digit maps to an exact number of binary bits. This makes it trivial to read, write, and spot patterns in binary data without lengthy arithmetic. Decimal has no such relationship with binary, so decimal conversions always require actual computation.

How do bases above 16 work?

For base 17–36, the convention is to continue using letters: G=16, H=17, …, Z=35. Base-32 (using A–V for 10–31) and base-36 (using A–Z for 10–35) appear in URL shorteners and identifiers. Base-64 uses A–Z, a–z, 0–9, +, / and is widely used for encoding binary data in email attachments and JSON Web Tokens.

What is a 'radix' and is it the same as a 'base'?

Yes — radix and base are synonyms in mathematics and computer science. Both refer to the number of unique digits a number system uses. Binary has radix 2, octal radix 8, decimal radix 10, and hexadecimal radix 16. The word 'radix' comes from Latin (meaning root) and appears in technical contexts; 'base' is the more colloquial term.