Number Base Converter
Converters · Added 15 August 2026
One converter for every base from 2 to 36. Enter a number in any base and see it in binary, octal, decimal and hexadecimal simultaneously, plus whatever target base you pick. Digits are validated against the source base, so an invalid input is an error rather than a silently wrong answer.
How to use the number base converter
- 1Enter your number. Prefixes like 0x, 0b and 0o are accepted and ignored.
- 2Choose the base it is currently written in.
- 3Choose the base you want it in.
- 4Press Convert. All four common bases appear together, so you rarely need a second conversion.
- 5Use the swap button to reverse the direction and carry the result across.
Examples
Decimal to hexadecimal
- Input
- 255 in base 10
- Result
- FF · binary 11111111 · octal 377
255 is the largest value a single byte holds, which is why it comes out as two identical hex digits.
Binary to decimal
- Input
- 1010 in base 2
- Result
- 10 · hex A · octal 12
Each binary place is a power of two: 8 + 0 + 2 + 0.
An invalid digit
- Input
- 12G in base 16
- Result
- Rejected, with the allowed digits listed
G is not a hex digit. Many converters silently parse this as 18 — a wrong answer is worse than an error.
About the number base converter
How positional notation works
Every base works the same way: each position is worth the base raised to the power of its index, counting from zero at the right. In decimal, 255 is 2×10² + 5×10¹ + 5×10⁰. In binary, 1010 is 1×2³ + 0×2² + 1×2¹ + 0×2⁰, which is 10. The only thing that changes between bases is the number that gets raised to those powers.
This is why converting to decimal is a single pass: read the digits left to right, multiplying the running total by the base and adding each digit. Converting from decimal is the reverse — repeated division by the target base, collecting remainders. Both are short enough to do by hand, which is worth trying once to see that nothing mysterious is happening.
It also explains why some bases are convenient together. Sixteen is two to the fourth, so four binary digits pack into exactly one hex digit with no arithmetic at all. Eight is two cubed, so three binary digits make one octal digit. Ten shares no such relationship with two, which is why decimal-to-binary conversion requires actual division while hex-to-binary is a substitution.
Why the validation matters
The most common bug in a base converter is silent truncation. JavaScript's parseInt stops at the first character it does not recognise and returns what it has so far, so parseInt('12G', 16) returns 18 rather than an error. The caller gets a number, has no indication anything went wrong, and carries the wrong value forward.
This converter validates each digit against the allowed set for the source base and refuses the whole input if any digit is invalid, naming the offending character and listing what is permitted. An error message costs a moment; a silently wrong address or colour value can cost considerably more.
The same principle applies to the size limit. Above about nine quadrillion, doubles can no longer represent every integer, so arithmetic starts skipping values — and a converter that carries on regardless will return confident-looking output that is simply incorrect in the low digits. Reporting the limit is the honest behaviour, and it is why the check happens during the parse rather than after.
Frequently asked questions
Why is one converter better than separate binary-to-decimal and decimal-to-hex pages?
What do the letters mean in bases above 10?
Why does hexadecimal appear everywhere in computing?
Can it convert fractions or negative numbers?
What is the largest number it handles?
Related tools
Base64 Encoder / Decoder
Developer Tools
Encode text to Base64 and decode it back, with full Unicode and URL-safe support.
Hash Generator
Developer Tools
Generate SHA-256, SHA-384, SHA-512 or SHA-1 digests of text or a file, and verify a checksum.
Data Storage Converter
Converters
Convert bytes, KB, MB, GB and TB — with binary and decimal units kept separate.