Number Base Converter
Convert a whole or fractional number between any two bases from 2 to 36 — binary, octal, decimal, hexadecimal or a custom radix — with the positional-notation expansion and a quick-reference row for every common base.
Written by Suhaib Hassan. Every conversion is re-derived digit by digit. Our methodology.
The integer part converts by repeated division; the fractional part converts by repeated multiplication — both done with exact BigInt fractions, not floating point, so long digit strings stay exact.
It shows every common base at once, so you can spot-check a hex color code or a binary flag against its decimal value instantly.
—
Quick reference — every common base
The same value shown in binary, octal, decimal and hexadecimal.
Step-by-step working
—
Worked examples
Decimal to binary
Convert 255 to binary.
255 = 11111111₂
Hex to decimal
Convert 0xDEADBEEF to decimal.
0xDEADBEEF = 3,735,928,559
Fractional part
Convert 42.625 to binary.
42.625 = 101010.101₂
How base conversion works
- Integer part, any base → decimal: multiply each digit by its place value (baseᵏ) and sum.
- Decimal → any base: repeatedly divide by the target base; the remainders, read from last to first, are the digits.
- Fractional part → any base: repeatedly multiply the fraction by the target base; the integer part produced each time is the next digit.
By Suhaib Hassan · Reviewed 29 September 2026 · How CalculatePilot verifies formulas →
Sources
- Knuth, D. E. (1997). The Art of Computer Programming, Vol. 2 (3rd ed.), section 4.4 (radix conversion).
- ISO 80000-2:2019, clause 13 (positional number systems).
Frequently asked questions
Why do some fractions never terminate in another base?
A fraction terminates in base b exactly when its reduced denominator's only prime factors are also prime factors of b. 0.1 (1/10) terminates in decimal but repeats forever in binary, because 5 is not a factor of 2 — the same reason 1/3 repeats in decimal.
What digits does a base above 10 use?
After 9, letters continue the sequence: A=10, B=11, … up to Z=35, allowing bases up to 36. Hexadecimal (base 16) uses 0–9 and A–F.
Why is base 16 so common in computing?
Each hex digit represents exactly 4 binary bits, so a byte is always exactly 2 hex digits — a much more compact and readable way to write binary data, used for memory addresses, color codes and more.
How large a number can this handle?
The integer part supports arbitrarily many digits (exact BigInt arithmetic); the fractional part is computed to 20 digits in the target base, noting if the expansion is truncated rather than exact.
What's the difference between octal and hexadecimal?
Both are shorthand for binary: octal (base 8) groups bits in 3s, hexadecimal (base 16) groups them in 4s. Hex is more common today because it aligns with 8-bit bytes; octal remains in use for Unix file permissions.
Related calculators
Continue with number bases.