Number base conversion: binary, octal, decimal, hexadecimal and any base up to 36
A number base (radix) is the number of distinct digits a positional system uses. Decimal uses ten digits (0–9), binary uses two (0, 1), octal eight, and hexadecimal sixteen (0–9 then A–F). The same quantity can be written in any base; only the representation changes. Converting between bases uses two simple procedures: expanding by place value to reach decimal, and repeated division to leave it.
The converter handles whole numbers in any base from 2 to 36 using exact big-integer arithmetic and shows both procedures, plus the bit-grouping shortcut between binary, octal and hex.
Key formulas
(dₖ…d₁d₀)_b = dₖ·bᵏ + … + d₁·b + d₀⌊log_b(n)⌋ + 1Worked examples
Convert 2024₁₀ to base 16.
- 2024 ÷ 16 = 126 remainder 8.
- 126 ÷ 16 = 7 remainder 14 (E).
- 7 ÷ 16 = 0 remainder 7.
- Read upward: 7E8.
Convert 11010110₂.
- 128 + 64 + 0 + 16 + 0 + 4 + 2 + 0.
- = 214.
Convert 755₈ (a Unix permission) to binary.
- Each octal digit becomes 3 bits: 7 → 111, 5 → 101, 5 → 101.
Write 1295 in base 36.
- 1295 ÷ 36 = 35 remainder 35 (Z).
- 35 ÷ 36 = 0 remainder 35 (Z).
Where each base is used
| Base | Name | Typical use |
|---|---|---|
| 2 | Binary | Bits, flags, digital logic |
| 8 | Octal | Unix file permissions |
| 10 | Decimal | Everyday arithmetic |
| 16 | Hexadecimal | Memory addresses, colors (#FF8800), byte dumps |
| 36 | Base-36 | Short IDs and URL shorteners (0–9 and A–Z) |
Bits, bytes and two's complement
Computers store whole numbers in fixed-width groups of bits: 8 bits make a byte, which holds 2⁸ = 256 different values (0 to 255, or 00 to FF in hexadecimal). That is why one hex digit corresponds to exactly four bits and two hex digits describe one byte.
Negative integers are usually stored in two's complement. To write −5 in 8 bits, take 5 = 00000101, invert every bit to get 11111010, then add 1: 11111011 (FB in hex). The same bit pattern read as an unsigned number is 251, so always check whether a value is meant to be signed. This converter works with the mathematical value and a minus sign; the Programmer calculator shows fixed-width two's complement views.
Common mistakes to avoid
- Reading the remainders top-down instead of bottom-up.
- Using a digit that does not exist in the base (like 8 in octal).
- Confusing the letter O with zero or I with one in high bases.
- Forgetting the place value of zero digits when expanding.
Frequently asked questions
Why do programmers use hexadecimal?
Does the converter handle negative numbers?
Can I convert fractional numbers?
How many digits will the result have?
Related tools and guides
Educational content. Results are computed in your browser with standard double-precision arithmetic; double-check anything with legal, financial, medical, or safety consequences. Spotted an error? Tell us and we will correct it.