Skip to content
UnitChart

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.

Number base reference table
DecimalHexadecimalBinaryOctal
0000
1111
22102
33113
441004
551015
661106
771117
88100010
99100111
10A101012
11B101113
12C110014
13D110115
14E111016
15F111117
16101000020
322010000040
64401000000100
100641100100144
1277F1111111177
1288010000000200
255FF11111111377
256100100000000400
51220010000000001000
10003E811111010001750
10233FF11111111111777
1024400100000000002000
4095FFF1111111111117777
40961000100000000000010000
65535FFFF1111111111111111177777
655361000010000000000000000200000

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.