Hex Calculator

Add, subtract, multiply or divide two hexadecimal numbers, or convert a number between hex and decimal.

Hexadecimal Calculation

Enter two hex numbers, using the digits 0 to 9 and the letters A to F, and pick an operation.

Hex to Decimal

Convert a hexadecimal number to a decimal number.

Decimal to Hex

Convert a whole decimal number to hexadecimal.

Hex, decimal and binary

DecimalHexBinaryDecimalHexBinary
000000881000
110001991001
22001010A1010
33001111B1011
44010012C1100
55010113D1101
66011014E1110
77011115F1111

How hexadecimal works

Hexadecimal, or hex, counts in base 16. It needs sixteen digits, so after 0 to 9 it uses the letters A to F for the values 10 to 15. Each place is worth sixteen times the one to its right. The hex number 2F is 2 × 16 plus 15, which is 47 in decimal. Hex is popular in computing because one hex digit stands for exactly four binary digits, so long binary numbers become short and easier to read.

Where hex is used

You meet hex in web colors such as #FF8800, where each pair of digits sets the red, green and blue amounts. It also appears in memory addresses, in MAC addresses, in character codes and in the byte values that programmers read when they debug. Two hex digits make up one byte, with values from 00 to FF, which is 0 to 255 in decimal.

Using the calculators

The first calculator adds, subtracts, multiplies and divides two hex numbers and shows the same sum in decimal so you can check it. Division gives a whole quotient and a remainder. The other two calculators convert in each direction. Letters can be typed in upper or lower case, results are shown in upper case, and negative whole numbers can be entered with a minus sign. The sums are exact for numbers of any size.

This calculator works with whole numbers. It shows negative numbers with a minus sign, and does not use the two’s complement form that computer hardware uses.

Common questions

How do you add hex numbers?

Add the digits column by column from the right, using decimal values for the letters. When a column reaches 16 or more, write the remainder and carry 1. For example, 8AB + B78 is 1423.

What do the letters A to F mean in hex?

They stand for the values 10 to 15: A is 10, B is 11, C is 12, D is 13, E is 14, and F is 15.

How do I convert hex to decimal?

Multiply each digit by 16 raised to its position, counting from 0 at the right, and add them up. DAD is 13 × 256 + 10 × 16 + 13, which is 3,501.

How do I convert decimal to hex?

Divide the number by 16 repeatedly and keep the remainders, writing 10 to 15 as A to F. Reading the remainders from last to first gives the hex number.

Why is hex used with binary?

One hex digit equals exactly four binary digits, so a byte is two hex digits. It is a compact way to write binary values.

More Math Calculators

Pick another tool to jump straight to it.