Number Base Converter

Convert numbers between decimal, binary, hexadecimal and octal — handy for students and programmers.

The number base converter translates a number between the four systems most used in computing and math: decimal (base 10, the everyday system), binary (base 2, used internally by computers), octal (base 8) and hexadecimal (base 16, common in colors, memory addresses and debugging). Type the number, choose the base it's written in, and see the equivalent value in the other three bases.

How to use

  1. Type the number you want to convert.
  2. Select which base it's written in (decimal, binary, octal or hexadecimal).
  3. Watch the equivalent values in the other three bases update automatically.

Worked example

While editing a site's CSS, you see white represented as #FFFFFF (hexadecimal) and want to understand the value of each color channel. Converting just "FF" (the maximum value of a channel, from 00 to FF) from hexadecimal gives 255 in decimal, 11111111 in binary, and 377 in octal. That's exactly why each RGB channel runs from 0 to 255: two hex digits cover exactly that range (16 × 16 = 256 possible values, from 0 to 255).

Frequently asked questions

How do I convert decimal to binary by hand?

Repeatedly divide the number by 2, noting the remainder each time, until you reach 0. The binary value is the remainders read from bottom to top. For example, 13 in decimal is 1101 in binary.

Why does hexadecimal use letters A through F?

Hexadecimal needs to represent 16 values per digit (0 to 15), but decimal digits only go up to 9. So the letters A, B, C, D, E and F stand in for the values 10 through 15.

Which characters are valid in each base?

Binary only accepts 0 and 1; octal accepts 0 through 7; decimal accepts 0 through 9; and hexadecimal accepts 0 through 9 plus the letters A through F (upper or lower case).

Why do computers use binary internally instead of decimal?

Because electronic circuits represent information more reliably with just two states (on/off, or 1/0), which maps naturally onto the binary system. Using a system with more digits per position, like decimal, would require reliably distinguishing between 10 different voltage levels, which is far more error-prone.

Why is octal still used if no one talks in base 8 day-to-day?

Octal used to be more popular in older systems because it groups bits into sets of 3 (since 2³ = 8), and it still shows up today in specific contexts, like file permissions on Unix/Linux systems (for example, "chmod 755").

What happens if I type a number too large for the converter to compute precisely?

Very large numbers (beyond JavaScript's safe calculation range, around 9 quadrillion in decimal) can lose precision. The converter detects this case and reports the number as invalid for conversion, instead of silently showing an imprecise result.