Support

Number

Runs in your browser· a calculator: nothing you type is sent anywhere

The number in each base
Binary1111 1111
Octal377
Decimal255
Hexff
73

As a fixed-width integer

Fits a signed 16-bit integer and an unsigned 8-bit integer.

WidthFitsBinary (two’s complement)Hex
8-bityes1111 1111ff
16-bityes0000 0000 1111 111100ff
32-bityes0000 0000 0000 0000 0000 0000 1111 1111000000ff
64-bityes0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 1111 111100000000000000ff

Convert between binary, decimal, hex and octal

Type a number in binary, octal, decimal or hex and see it in all the others at once, plus any base from 2 to 36. Digits are grouped for reading, large values stay exact, and a table shows the two's complement bit pattern of the number as an 8, 16, 32 or 64-bit integer, so you can see whether it fits and how negatives are stored.

Frequently Asked Questions

How do I convert binary to decimal?
Choose Binary as the input base and type the bits; the decimal value appears at once. By hand, each bit is worth a power of two from the right: 1011 is 8 + 0 + 2 + 1 = 11. Spaces, underscores and a 0b prefix are accepted.
How do I convert hex to decimal?
Choose Hex and type the value, with or without 0x. Each hex digit is worth 4 bits, and a to f stand for 10 to 15, so ff is 15 x 16 + 15 = 255. The decimal, binary and octal forms are shown together.
Are very large numbers exact?
Yes. The page uses arbitrary-precision integers, so values above 9,007,199,254,740,991 (the largest safe JavaScript number) convert without rounding. For example ffffffffffffffff is 18,446,744,073,709,551,615.
What is two's complement?
It is how computers store negative integers in a fixed number of bits. For a negative number the bit pattern is the value plus 2 to the power of the width, so -1 is 11111111 in 8 bits. The table shows the pattern for 8, 16, 32 and 64 bits, and says when a number does not fit.

Found this useful? Hexabench is free and ad-free. If it saved you time, you can support it.

Buy me a coffee →