Number Base Converter

Type a number in binary, decimal, hexadecimal or octal and every other base fills in as you type. It flags invalid digits for the base you picked, so a stray 2 in a binary string will not silently give you a wrong answer.

Number Base Converter tool

BaseValue
Binary (2)
Octal (8)
Decimal (10)
Hexadecimal (16)

Tap a value to copy it.

How to use it

  1. Type your number in the box.
  2. Choose which base you typed it in.
  3. Read every other base below, and tap a value to copy it.

Worked example

Input: 255 in decimal
Result: 11111111 binary, FF hex
Input: 1010 in binary
Result: 10 decimal, A hex

Binary, hex and why programmers use them

Every base works the same way: each position is worth the base raised to a power. In decimal, 255 is 2 hundreds plus 5 tens plus 5 ones. In binary the positions are 128, 64, 32, 16, 8, 4, 2 and 1, so 255 is eight ones in a row, 11111111.

Hexadecimal is compact shorthand for binary. One hex digit covers exactly four binary digits, so a byte is always two hex characters: FF is 255, and 00 is zero. That is why colors on the web are written as hex, where #FF0000 means full red, no green and no blue.

Octal groups binary in threes and survives mainly in Unix file permissions, where 755 means read, write and execute for the owner and read plus execute for everyone else.

Common uses

  • Reading hex color codes
  • Converting file permissions in Unix
  • Programming, bitmasks and debugging
  • Computer science homework

Frequently asked questions

11111111, which is eight ones. That is the largest value a single byte can hold, and it is why 255 shows up so often in color codes and network masks.
Multiply each digit by 16 raised to its position. FF is 15 times 16 plus 15, which is 255. Paste the value above with hexadecimal selected to see it instantly.
One hex digit maps to exactly four binary digits, so hex writes binary compactly without losing the bit pattern. A byte is always two hex characters, which makes memory dumps and color codes readable.
Yes. A leading 0x, 0b or 0o is ignored, as are spaces, commas and underscores used as separators, so you can paste values straight from code.