Hexadecimal calculator
Convert a hexadecimal number to decimal and binary.
Try it
Inputs
Result
The result appears here as you type.
About Hexadecimal calculator
A hexadecimal calculator converts a base-16 number into decimal and binary. Hexadecimal uses the digits 0 to 9 and the letters A to F, where A stands for 10 and F for 15. It is widely used in computing, colour codes, memory addresses and error messages. Enter a hexadecimal number, and the calculator returns its decimal value and binary form.
Each hexadecimal digit represents exactly four binary digits, which makes hex a compact way to read long binary numbers. The calculator accepts an optional 0x prefix, which programmers often write.
How to use Hexadecimal calculator
- Enter the hexadecimal digits, using 0 to 9 and A to F.
- The 0x prefix is optional and is ignored if present.
- Read the decimal value.
- Read the binary form, which shows the same number in base 2.
- Check that the digits are valid, since letters beyond F are not allowed.
Place values
Each position in a hexadecimal number is a power of sixteen. The value of 1F is 1 times 16 plus 15, which is 31. The value of 2A0 is 2 times 256 plus 10 times 16 plus 0, which is 672.
Converting a hex digit to binary is simple because each digit maps to four bits. F is 1111 and 1A is 00011010 in full eight-bit form.
Hex in everyday computing
Web colours such as #FF8800 are three pairs of hex digits for red, green and blue. Memory dumps and network addresses are often shown in hex because it lines up neatly with bytes.
The letters can be upper or lower case, so 1f and 1F give the same value.
Frequently asked questions
What do the letters A to F mean?
They stand for the values 10 to 15, so A is 10, B is 11 and so on up to F for 15.
Can I use negative hex numbers?
This calculator takes unsigned values only. Negative numbers use a separate convention such as two's complement.
Why do programmers use hex?
It is shorter than binary and maps directly to bytes, so it is easier to read.
Related tools
Tools that pair well with this one.