Skip to content
ToolBoxGenie

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.

Prefixes like 0x, 0b and 0o are accepted and ignored.

How to use the number base converter

  1. 1Enter your number. Prefixes like 0x, 0b and 0o are accepted and ignored.
  2. 2Choose the base it is currently written in.
  3. 3Choose the base you want it in.
  4. 4Press Convert. All four common bases appear together, so you rarely need a second conversion.
  5. 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?
Because they would be the same tool with the dropdowns pre-set, published a dozen times over. That is near-identical content across many URLs, which search engines treat as doorway pages and which serves nobody — you would have to find the right page instead of picking two dropdowns. This converter answers all of those questions at once and shows the four common bases together.
What do the letters mean in bases above 10?
They are digits. Base 16 needs sixteen digit symbols, so after 0–9 it continues A, B, C, D, E, F for the values 10 to 15. Higher bases keep going through the alphabet, up to Z for 35 in base 36. Case does not matter on input.
Why does hexadecimal appear everywhere in computing?
Because four binary digits map to exactly one hex digit, so hex is a compact way to write binary without losing the bit structure. A byte is exactly two hex digits, a 32-bit colour is exactly eight. Converting between hex and binary is a lookup rather than arithmetic, which is why programmers read memory dumps in hex rather than binary or decimal.
Can it convert fractions or negative numbers?
Negative numbers yes, fractions no. Fractional digits in a non-decimal base often cannot be represented exactly — a tenth is a repeating fraction in binary, which is the root of most floating-point surprises — so the converter refuses rather than rounding and presenting an approximation as exact.
What is the largest number it handles?
About 9 quadrillion, the point at which JavaScript's numbers stop representing every integer exactly. Beyond that the converter reports an error rather than returning a value that looks precise and is not.