Skip to content

Number Base Converter

Convert between binary, octal, decimal, and hexadecimal.

The base the number above is written in.

Prefixes (0x, 0b, 0o) and _ or , separators are allowed.

Decimal (base 10)

255
Hexadecimal (base 16)
ff
Octal (base 8)
377
Binary (base 2)
11111111

Converted in your browser. Nothing you enter is uploaded, logged, or stored.

How the base converter works

A number’s value never changes when you write it in a different base. Two hundred fifty-five is the same quantity whether you spell it 255 in decimal, ff in hexadecimal, 377 in octal, or 11111111 in binary. A base is just how many distinct digits you use before you carry to the next column: 10 in decimal, 2 in binary, 8 in octal, and 16 in hex (which borrows the letters a to f for the digits ten to fifteen).

This tool reads the number you type, checks that every digit is legal for the base you chose, and then re-expresses that single value in all four bases at once. Parsing works left to right: it starts at zero and, for each digit, multiplies the running total by the base and adds the new digit. Converting back out repeats the reverse, peeling off one digit at a time. Because the math is done on whole numbers with arbitrary precision, a value with hundreds of digits converts exactly, with no rounding and no precision limit.

Worked example

Take the hexadecimal value 1a, and read it as base 16.

  • The leading digit 1 is worth 1 * 16 = 16.
  • The next digit a is worth ten, in the ones column: 10 * 1 = 10.
  • Total value: 16 + 10 = 26 in decimal.

Now render 26 in the other bases:

Base Digits Result
Decimal (10) 2 then 6 26
Hexadecimal (16) 1 then a 1a
Octal (8) 3 then 2 32
Binary (2) 1 1 0 1 0 11010

To check the binary: 11010 is 16 + 8 + 0 + 2 + 0 = 26. And 32 in octal is 3 * 8 + 2 = 26. Every form is the same quantity, just grouped into different column sizes.

How to use it

  • Pick the input base that matches how your number is written.
  • Type or paste the value. Prefixes like 0x, 0b, and 0o, plus _ or , separators, are accepted and ignored.
  • Read all four bases in the results. Decimal is shown first; hex, octal, and binary follow.
  • Watch for the error message. If a digit is illegal for the base, the field flags it instead of guessing.
  • Trust large values. Long hex keys or big binary masks convert without losing a single digit.

Limitations

This converter handles non-negative whole numbers only. It does not convert fractions, negative numbers, or signed two’s-complement bit patterns, and it does not interpret a value as a fixed-width register, so it will not pad results to 8, 16, 32, or 64 bits. If you need a signed or fixed-width view, add the padding or sign handling yourself. The output is a faithful re-spelling of the value you entered, not a comment on what that value represents in any particular system.

Frequently asked questions

Which bases can I convert between?

Binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). You pick the base your number is written in, and the converter shows all four at once. These are the four bases that show up everywhere in programming: binary for bits and masks, octal for file permissions, decimal for everyday numbers, and hex for colors, memory addresses, and byte values.

Can it handle very large numbers?

Yes. Integers are converted with arbitrary precision, so a 64-bit or 256-bit value comes out exact, with no rounding. Plain JavaScript loses precision above about 9 quadrillion, but this converter does not, because it works on the digits directly rather than through a floating-point number.

Why does it reject my input?

Every digit has to be valid for the base you chose. An 8 or 9 is not a legal octal digit, a 2 is not a legal binary digit, and a letter past F is not a legal hex digit, so any of those is flagged. Negative numbers, decimal points, and fractions are also rejected, because this tool converts non-negative whole numbers only.

Can I paste a value with a 0x or 0b prefix?

Yes. A prefix that matches the chosen base is recognized and stripped, so 0xff in hex, 0b1010 in binary, and 0o377 in octal all work. You can also use underscores or commas as group separators, like 1111_1111, and a single leading plus sign. Case does not matter for the prefix or the hex digits.

Is my input sent anywhere?

No. The conversion runs entirely in your browser as you type. Nothing is uploaded, logged, or stored on a server, so it is safe for keys, tokens, addresses, or any value you would rather keep private.

Why is hex output lowercase?

The converter renders hexadecimal digits in lowercase for a single consistent style. It accepts uppercase, lowercase, or mixed input, so DeadBeef and deadbeef parse to the same value, but the result is always shown one way to avoid ambiguity when you copy it.