Skip to content
digiwleea Tools
Learn Open the lab →

Hex calculator

A hex calculator does arithmetic directly in base 16, where the digits run 0 to 9 and then A (10) to F (15) and every column carries at 16 instead of 10. Enter two hex numbers below to add, subtract, multiply or divide them, with the answer in hex, decimal and binary and the working shown: 3F + 2A = 69.

How hex addition works

Exactly like decimal addition, column by column from the right, except that a column overflows at 16. For 3F + 2A: the right column is F + A = 15 + 10 = 25, which is 16 + 9, so write 9 and carry 1. The left column is 3 + 2 + 1 = 6. The answer is 69 in hex, which is 105 in decimal, and indeed 63 + 42 = 105. A useful shortcut: when a column reaches 16 or more, subtract 16 and carry 1.

How hex subtraction works

A column that is too small borrows 16 from the column to its left. For 52 - 2E: the right column is 2 - E, too small, so borrow: 2 + 16 - 14 = 4. The left column is now 5 - 1 - 2 = 2. The answer is 24, which is 36, and 82 - 46 = 36. Multiplication works the same way with one partial product per digit, each shifted one place (a factor of 16), and the calculator lists them.

Hex digits

HexDecimalBinaryHexDecimalBinary
000000881000
110001991001
220010A101010
330011B111011
440100C121100
550101D131101
660110E141110
770111F151111

Each hex digit is exactly four bits, which is why programmers use hex: a byte is two hex digits (FF is 1111 1111, 255), memory addresses and machine code are written in it, and web colors such as #FF8800 are three bytes of red, green and blue. Read more in the hexadecimal lesson.

Frequently asked

How do you add hexadecimal numbers?

Add column by column from the right. If a column's total reaches 16 or more, write the total minus 16 and carry 1 to the next column. For example 3F + 2A: F + A = 25 = 16 + 9, write 9 carry 1; then 3 + 2 + 1 = 6, so the sum is 69.

What is F + 1 in hex?

10. F is 15, and 15 + 1 = 16, which in hex is one 16 and zero units: 10. Likewise FF + 1 = 100.

How do you subtract in hex?

Subtract column by column from the right; when a digit is too small, borrow 16 from the column to its left, which then has 1 less. For example 52 - 2E: 2 + 16 - E = 4, then 5 - 1 - 2 = 2, so the difference is 24.

How do you multiply hex numbers?

Multiply the first number by each hex digit of the second, shift each partial product one hex place per digit (multiply by 16), and add them up, just as in long multiplication. The calculator lists the partial products.

What is 0xFF in decimal?

255: F is 15, so FF is 15 x 16 + 15 = 255, the largest value of one byte. The 0x prefix just marks the number as hexadecimal.

Convert between bases with the number base converter, or see the same arithmetic in base 2 with the binary calculator, which shows the carries a chain of full adders computes.

Related tools: bitwise calculator, two's complement calculator and binary converter. How multi-byte values are laid out in memory: big-endian vs little-endian. Text as hex bytes: ASCII vs Unicode.

Open the lab →