Home / Math

Number base converter

Convert between decimal, binary, octal and hexadecimal.

Decimal value
255
  • Binary11111111
  • Octal377
  • HexadecimalFF

Handles whole numbers of any size. Hexadecimal digits can be upper or lower case, and a 0x prefix is accepted.

How this number base converter works

Type a whole number, choose the base it is written in, and the converter shows it in decimal (base 10), binary (base 2), octal (base 8) and hexadecimal (base 16). It handles numbers of any size and accepts a 0x prefix for hexadecimal.

How bases work

In decimal, each place is worth 10 times the one to its right: ones, tens, hundreds. In binary each place is worth 2 times the last (1, 2, 4, 8, 16 and so on), in octal 8 times, and in hexadecimal 16 times. Hexadecimal needs 16 digits, so it uses 0 to 9 and then A to F for 10 to 15.

Worked examples

255 in decimal is 11111111 in binary, 377 in octal and FF in hexadecimal, which is the largest value that fits in one byte. Going the other way, binary 1010 is 8 + 2 = 10, and hex 1A is 16 + 10 = 26.

Where you will see these

Binary is how computers store data. Hexadecimal is a compact way to write binary, since each hex digit stands for exactly 4 bits, and it shows up in web colors (#FF8800 is red 255, green 136, blue 0), memory addresses and error codes. Octal is used for file permissions on Linux and macOS, such as 755.

Common questions

Can I enter negative numbers? Yes, with a minus sign. The converter shows the negative value in each base rather than a computer's two's-complement form.