Number Base Converter
Convert between hexadecimal, decimal, binary and octal. Type into any box and the other three update as you go.
All base conversions
decimal to hexdecimal to binarydecimal to octalhex to decimalhex to binaryhex to octalbinary to decimalbinary to hexbinary to octaloctal to decimaloctal to hexoctal to binary
Hex, decimal, binary and octal reference table
The values programmers look up most: every single hex digit, the byte boundaries and the power-of-two edges.
| Decimal | Hexadecimal | Binary | Octal |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 2 | 10 | 2 |
| 3 | 3 | 11 | 3 |
| 4 | 4 | 100 | 4 |
| 5 | 5 | 101 | 5 |
| 6 | 6 | 110 | 6 |
| 7 | 7 | 111 | 7 |
| 8 | 8 | 1000 | 10 |
| 9 | 9 | 1001 | 11 |
| 10 | A | 1010 | 12 |
| 11 | B | 1011 | 13 |
| 12 | C | 1100 | 14 |
| 13 | D | 1101 | 15 |
| 14 | E | 1110 | 16 |
| 15 | F | 1111 | 17 |
| 16 | 10 | 10000 | 20 |
| 32 | 20 | 100000 | 40 |
| 64 | 40 | 1000000 | 100 |
| 100 | 64 | 1100100 | 144 |
| 127 | 7F | 1111111 | 177 |
| 128 | 80 | 10000000 | 200 |
| 255 | FF | 11111111 | 377 |
| 256 | 100 | 100000000 | 400 |
| 512 | 200 | 1000000000 | 1000 |
| 1000 | 3E8 | 1111101000 | 1750 |
| 1023 | 3FF | 1111111111 | 1777 |
| 1024 | 400 | 10000000000 | 2000 |
| 4095 | FFF | 111111111111 | 7777 |
| 4096 | 1000 | 1000000000000 | 10000 |
| 65535 | FFFF | 1111111111111111 | 177777 |
| 65536 | 10000 | 10000000000000000 | 200000 |
Decimal (base 10)
Decimal is base 10, the everyday number system, using the digits 0 to 9. Each place is worth ten times the one to its right.
Hexadecimal (base 16)
Hexadecimal is base 16, using 0 to 9 then A to F for the values ten to fifteen. One hex digit encodes exactly four bits, so a byte is always two hex digits — which is why colours, memory addresses and hashes are written in hex.
Binary (base 2)
Binary is base 2, using only 0 and 1. It is how every digital computer physically stores and manipulates data, with each digit representing one bit.
Octal (base 8)
Octal is base 8, using the digits 0 to 7. One octal digit encodes exactly three bits, which is why Unix file permissions are written as octal numbers such as 755.
Frequently asked questions
How do you convert hex to decimal by hand?
Multiply each hex digit by 16 raised to its position, counting from zero on the right, and add the results. For 1F: (1 × 16) + (15 × 1) = 31. The letter F stands for fifteen.
Why do programmers use hexadecimal?
One hex digit maps to exactly four bits, so a byte is always exactly two hex digits and nothing is ever ambiguous. Writing the same byte in decimal takes one, two or three digits, which makes memory dumps and colour codes far harder to read.
What do the prefixes 0x, 0b and 0o mean?
They tell a compiler which base a literal is written in: 0x for hexadecimal, 0b for binary and 0o for octal. 0x10, 0b10000 and 16 are all the same number. This converter accepts the prefixes and ignores them.
How large a number can this convert?
There is no practical limit. Conversions use arbitrary-precision integers, so 64-bit and larger values convert exactly instead of losing precision the way ordinary floating point arithmetic would above about 9 quadrillion.