Number Base Converter

This number is in

This free number base converter shows a whole number in binary, octal, decimal, and hexadecimal at the same time. Enter a number, choose which base it's written in, and every representation updates instantly below. Nothing you enter is sent anywhere or stored.

How to Use It

  1. Type a number into the Number field.
  2. Choose which base that number is written in: Binary, Octal, Decimal, or Hexadecimal.
  3. The value in all four bases appears below, and updates instantly as you edit the number or change the base.

How It Works

Every number system represents the same value using a different set of digits and a different place value for each position. Decimal (base 10) uses ten digits, 0 through 9, where each position is worth ten times the one to its right. Binary (base 2) uses only 0 and 1, where each position is worth twice the one to its right. Octal (base 8) and hexadecimal (base 16) work the same way, with 8 and 16 digits respectively, hexadecimal borrowing the letters A through F once it runs out of numerals.

A worked example: the decimal value 255 is 11111111 in binary (eight 1s: 128 plus 64 plus 32 plus 16 plus 8 plus 4 plus 2 plus 1), 377 in octal, and FF in hexadecimal. All four are the exact same value, just written with a different set of digits and place values.

This tool uses arbitrary-precision integer math internally, so a value far beyond what a normal number type can represent exactly still converts correctly. Everything runs client-side in your browser. Nothing you enter is sent anywhere or stored.

Frequently Asked Questions

Why one input and a base selector instead of four separate fields?

So the tool always has one clear input you're in control of, with the results shown separately below it, the same input-and-results pattern every other tool on this site uses. An earlier version used four fields that all doubled as input and output, so typing in one silently overwrote the other three, making it hard to convert a second number without losing track of the first. Keeping the input field stable means you can change the number, change the base, or both, without anything getting overwritten out from under you.

What happens when I switch the base selector?

The tool re-reads whatever is currently in the Number field under the newly selected base. It never rewrites what you typed, so if the current text is not valid in the newly selected base (switching to Binary while the field contains "255", for example), you get a clear error instead of the tool silently changing your input to something else.

Why does the hexadecimal result show uppercase letters even if I type lowercase?

Both are valid hexadecimal, uppercase is simply the more common convention for displaying a hex value, so lowercase input is accepted and the hexadecimal result is normalized to uppercase. The Number field itself still shows exactly what you typed, only the result is normalized.

Does this handle negative numbers or decimals?

No, this tool is scoped to non-negative whole numbers only. Binary, octal, and hexadecimal representations of a negative number depend on an assumed bit width (two's complement), which this tool has no fixed value for, and converting a fractional value between bases is a different, less commonly needed problem than whole-number conversion.

Why did I get an error?

The selected base only accepts its own valid digits, binary only 0 and 1, octal 0 through 7, decimal 0 through 9, and hexadecimal 0 through 9 plus A through F. A character outside that set (a 2 while Binary is selected, a G while Hexadecimal is selected) produces a clear error naming the problem.

How large a number can this handle?

Any size. This tool uses arbitrary-precision integer math internally, not a fixed-size number type, so a value far larger than JavaScript's normal safe integer limit still converts exactly, with no rounding or precision loss.