Saved

Press the star next to a tool's name to save it.

All my tools

Add Hexadecimal Numbers Calculator

This hex calculator adds, subtracts, multiplies and divides hexadecimal numbers. Type two numbers using the digits 0 to 9 and A to F, pick an operation and get the answer in hex, with the decimal check and the binary form.

Restored your last values ·

Choose an operation and type two hex numbers using 0 to 9 and A to F. A 0x prefix, spaces and underscores are ignored. Negative numbers start with a minus sign.

Everything is worked out in your browser. Nothing you type is sent anywhere.

–

–

Enter two hexadecimal numbers to see their sum, difference, product or quotient.

What this hex calculator does

Hexadecimal, or hex for short, is a positional numeral system that represents a numeric value in base 16. [1] This hex calculator performs the four basic operations on two hex numbers: add, subtract, multiply and divide. It is the quickest way to add hexadecimal numbers when you meet them in colour codes, memory addresses or machine code.

You get the answer in hex, a decimal version of the same sum so you can check it, and the result in binary. Numbers can be as long as 60 characters, and the sums are exact because the calculator uses whole-number arithmetic with no rounding.

How hex digits work

Hex uses sixteen symbols. The digits 0 to 9 look the same as in decimal, and the letters A to F stand for the values 10 to 15. [1] Upper and lower case mean the same thing. So A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15.

Hex digitABCDEF
Decimal value101112131415

Each place is worth sixteen times the place on its right. In 1A, the 1 is in the sixteens place and the A is in the units place, so 1A means 1 × 16 + 10 = 26.

How to use the hex calculator

  1. Choose Add, Subtract, Multiply or Divide.
  2. Type the first hex number, for example 1A.
  3. Type the second hex number, for example FF.
  4. Press Calculate. The result appears in hex, followed by the decimal check and the binary form.

You may type a 0x in front of a number, as programmers often do. Spaces, commas and underscores are ignored, so a long value can be grouped for readability.

Adding hexadecimal numbers

Addition works like decimal addition, except a column carries when it reaches sixteen instead of ten. One can also do elementary operations directly in the hex system itself, or convert to another base first. [1] Take 1A + FF. In the units column, A (10) plus F (15) is 25, which is 16 plus 9, so write 9 and carry 1. In the sixteens column, 1 plus F (15) plus the carried 1 is 17, which is 16 plus 1, so write 1 and carry 1. The final carry becomes the leading 1. The answer is 119 in hex.

As a check, 1A is 26 in decimal and FF is 255. Their sum is 281, and 119 in hex is 1 × 256 + 1 × 16 + 9 = 281. The calculator prints this check for you.

Subtraction, multiplication and division

  • Subtraction borrows sixteen when a column is too small. If the second number is larger, the result is negative and shows a minus sign.
  • Multiplication of FF by FF gives FE01 in hex, which is 255 × 255 = 65,025 in decimal.
  • Division returns a whole-number quotient and a remainder. FF divided by 10 gives F with a remainder of F, because 255 = 16 × 15 + 15.
  • Division by zero is not allowed and gives an error.

Worked examples

SumHex resultDecimal check
1A + FF11926 + 255 = 281
FF × FFFE01255 × 255 = 65025
FF ÷ 10F remainder F255 ÷ 16 = 15 remainder 15
A − FF−F510 − 255 = −245

Where hex arithmetic is used

  • Web colours, where each channel is two hex digits from 00 to FF.
  • Memory addresses and offsets, where adding to an address is common.
  • Debugging machine code and looking at byte values.
  • Checking homework on number bases.

Tips and common mistakes

  • Do not type a letter outside A to F. A G or an H is not a hex digit and gives an error.
  • Remember that a column carries at sixteen. Writing 10 in hex means sixteen, not ten.
  • A 0x prefix is only a label. It does not change the value.
  • For negative results, the minus sign is in front, and the binary line is skipped because a plain binary form of a negative number depends on a chosen width.

If you only want to change a number between bases, without arithmetic, the binary and text converters on this site may suit you better. This hex calculator is for sums between two numbers that are already in base 16.

How subtraction and borrowing work in hex

Subtraction in hex follows the same pattern as in decimal. When the top digit in a column is smaller than the bottom digit, you borrow one from the next column, and that borrowed one is worth sixteen, not ten. For example, in 20 minus 1, the units column cannot take 1 from 0, so borrow 1 from the sixteens column. That gives 16 in the units column, and 16 minus 1 is 15, which is F. The answer is 1F. The calculator confirms this with the decimal line, 32 minus 1 equals 31.

Multiplying hex numbers

Multiplying by hand needs a hex multiplication table, which most people do not remember. A practical method is to convert each number to decimal, multiply, and convert back. The calculator does the equivalent exactly and shows the decimal check, so you can compare it with your own work. Multiplying by 10 in hex, which is sixteen, simply adds a zero at the end, in the same way that multiplying by ten adds a zero in decimal.

Reading the binary line

The binary result is a useful extra. Each hex digit equals exactly four binary digits, so a long hex answer maps cleanly onto bits. FE01 in binary is 1111 1110 0000 0001. If you work with bit flags or masks, this line saves a separate conversion.

What next

Use this often? Add Add Hexadeci to your Home screen.

Frequently asked questions

What is a hex calculator?

It is a tool that adds, subtracts, multiplies and divides numbers written in base 16, using the digits 0 to 9 and A to F.

How do I add hexadecimal numbers?

Add column by column from the right and carry 1 whenever a column reaches 16. For example, 1A + FF = 119 in hex.

What does A to F mean in hex?

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

Does this hex calculator handle negative numbers?

Yes. Put a minus sign in front of a number, and a negative result is shown with a minus sign.

Can it divide hex numbers?

Yes. It gives a whole-number quotient and a remainder, both in hex.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Math Tools