← Math Calculators

Hex Calculator

Use this free hex calculator to convert between decimal and hexadecimal in either direction. Choose decimal to hex or hex to decimal, enter the number, and get the converted result right away. Hex is common in computing, where two hex digits hold exactly one byte of data.

How it works

Hexadecimal is the base-16 number system, using the digits 0–9 plus the letters A–F for the values 10–15. Each hex place is worth 16 times the place to its right. So the hex number FF means 15 × 16 + 15, which is 255 in decimal, and 1A means 1 × 16 + 10, which is 26.

To convert decimal to hex, repeatedly divide by 16 and read the remainders backwards, turning remainders of 10–15 into A–F. To convert hex to decimal, add up each digit times its place value. This calculator does both directions — choose one and enter the number.

If the hex input contains a letter past F, such as G, the calculator says so instead of guessing, because that is not a hexadecimal number. Hex is common in computing, where it is a compact way to write binary values and colors: two hex digits hold exactly one byte.

Example: Converting the decimal number 26 to hexadecimal gives 1A.

Frequently asked questions

How do I convert decimal to hex?

Repeatedly divide by 16 and read the remainders backwards, turning remainders of 10 to 15 into A to F. Choose Decimal to Hex, enter the number, and the calculator does it for you.

What happens if I enter a letter past F in hex?

The calculator tells you the input is invalid instead of guessing. Hexadecimal uses only the digits 0 to 9 and the letters A to F, so a letter like G is rejected.

More Math Calculators

← Back to all calculators