Hex Calculator

Use this calculator to quickly add, subtract, multiply, and divide hexadecimal values.

Hex Result:

0

DEC: 0

BIN: 0

OCT: 0

How to Use the Calculator?

To use the calculator, first enter a hexadecimal number into Value A and a second one into Value B. Then, select whether you wish to add, subtract, multiply, or divide them. As you type, the answer will automatically appear in the Result box. For your convenience, the same answer will also be displayed in decimal, binary, and octal formats.

What Is Hexadecimal?

Hexadecimal math is a number system skill that looks strange at first, but once you understand the pattern, it becomes very manageable.

First, remember what hexadecimal means. In ordinary math, we usually use the decimal system, which is base $10$. That means each place value is a power of $10$. Hexadecimal is base $16$, so each place value is a power of $16$.

In decimal, the digits are $0,1,2,3,4,5,6,7,8,9$.

In hexadecimal, we need 16 symbols, so we use:

$0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F$

These letters stand for extra values:

$$A = 10$$
$$B = 11$$
$$C = 12$$
$$D = 13$$
$$E = 14$$
$$F = 15$$

So in hexadecimal, after $9$ comes $A$, then $B$, and so on until $F$. After $F$, the next number is not another single digit, because we have used all 16 symbols. So we “carry” to the next place, just like decimal goes from $9$ to $10$.

$$10_{16} = 16_{10}$$

That means hexadecimal $10$ is equal to decimal $16$.

To do hexadecimal math well, you should keep two ideas in mind. First, each digit has a value from $0$ to $15$. Second, carrying and borrowing happen at $16$ instead of $10$.

Hexadecimal Addition

Let us begin with hexadecimal addition.

When adding hexadecimal numbers, the process is almost exactly like decimal addition. You add the digits in each column from right to left. If the sum is less than $16$, write it down. If the sum is $16$ or more, write down the remainder and carry $1$ to the next column.

Example 1

A very small example is $7 + 5$ in hexadecimal. In decimal, $7 + 5 = 12$. In hexadecimal, decimal $12$ is written as $C$. So:

$$7_{16} + 5_{16} = C_{16}$$

Now look at $8 + 9$ in hexadecimal. In decimal, $8 + 9 = 17$. Since $17 = 16 + 1$, that means the hexadecimal answer is $11$.

$$8_{16} + 9_{16} = 11_{16}$$

Why? Because one group of $16$ is carried, and $1$ is left over.

Example 2

Now let us do a larger example:

$$2A_{16} + 17_{16}$$

Work from right to left. In the ones place, $A + 7$ means $10 + 7 = 17$ in decimal. Since $17 = 16 + 1$, we write $1$ and carry $1$.

Then in the next column, $2 + 1 + 1 = 4$.

So the answer is:

$$2A_{16} + 17_{16} = 41_{16}$$

Let us check it in decimal to be sure. Hexadecimal $2A$ means:

$$2A_{16} = 2 \cdot 16 + 10 = 42_{10}$$

Hexadecimal $17$ means:

$$17_{16} = 1 \cdot 16 + 7 = 23_{10}$$

And $42 + 23 = 65$. Now check hexadecimal $41$:

$$41_{16} = 4 \cdot 16 + 1 = 65_{10}$$

It works.

Example 3

Here is another addition example:

$$3F_{16} + 2D_{16}$$

Start with the right column. $F + D$ means $15 + 13 = 28$ in decimal. Now divide $28$ by $16$. That gives $1$ group of $16$ with $12$ left over. Decimal $12$ is hexadecimal $C$. So write $C$ and carry $1$.

Now add the next column: $3 + 2 + 1 = 6$.

So:

$$3F_{16} + 2D_{16} = 6C_{16}$$

You can think of hexadecimal addition as “regular addition, but with base $16$ rules.”

Hexadecimal Subtraction

Now let us move to subtraction.

Hexadecimal subtraction is also very similar to decimal subtraction. You subtract from right to left. If the top digit is smaller than the bottom digit, you borrow $1$ from the next column. But here is the important difference: when you borrow $1$ in hexadecimal, you are really borrowing $16$, not $10$.

Example 1

Let us start with a simple example:

$$C_{16} – 5_{16}$$

Since $C = 12$, we have $12 – 5 = 7$.

$$C_{16} – 5_{16} = 7_{16}$$

Now a subtraction with borrowing:

$$23_{16} – 7_{16}$$

In the ones place, $3 – 7$ cannot be done, so we borrow $1$ from the $2$ in the next place. That borrowed $1$ is worth $16$ in the current place.

So the ones place becomes:

$$3 + 16 = 19$$

Then:

$$19 – 7 = 12 = C_{16}$$

After borrowing, the $2$ becomes $1$. So the final answer is:

$$23_{16} – 7_{16} = 1C_{16}$$

Let us check in decimal. $23_{16} = 35_{10}$ and $7_{16} = 7_{10}$. Then $35 – 7 = 28$. Also, $1C_{16} = 16 + 12 = 28$. Correct.

Example 2

Now try a bigger example:

$$5A_{16} – 2F_{16}$$

Start at the right. $A – F$ means $10 – 15$, which cannot be done. Borrow $1$ from the $5$. That borrowed $1$ adds $16$ to the $A$.

$$10 + 16 = 26$$

Then subtract:

$$26 – 15 = 11 = B_{16}$$

The $5$ becomes $4$ after borrowing. Then $4 – 2 = 2$.

So:

$$5A_{16} – 2F_{16} = 2B_{16}$$

Hexadecimal Multiplication

Now we come to multiplication.

Hexadecimal multiplication follows the same overall method as decimal multiplication. The main challenge is remembering the hexadecimal digit values and converting products back into hexadecimal.

Example 1

Let us begin with a one-digit example:

$$A_{16} \times 3_{16}$$

Since $A = 10$, this is $10 \times 3 = 30$ in decimal. Now convert $30$ back to hexadecimal.

$$30 = 1 \cdot 16 + 14$$

Since decimal $14 = E$, we get:

$$A_{16} \times 3_{16} = 1E_{16}$$

Now another one:

$$B_{16} \times 4_{16}$$

Since $B = 11$, we get $11 \times 4 = 44$ in decimal. Convert $44$ to hexadecimal.

$$44 = 2 \cdot 16 + 12$$

And decimal $12 = C$, so:

$$B_{16} \times 4_{16} = 2C_{16}$$

Example 2

Now let us do a two-digit multiplication:

$$2A_{16} \times 3_{16}$$

We multiply each digit by $3$, starting from the right.

First, $A \times 3 = 10 \times 3 = 30$ decimal, which is $1E$ hexadecimal. Write $E$ and carry $1$.

Then $2 \times 3 = 6$, and add the carry $1$ to get $7$.

So:

$$2A_{16} \times 3_{16} = 7E_{16}$$

Let us verify. $2A_{16} = 42_{10}$ and $42 \times 3 = 126$. Also:

$$7E_{16} = 7 \cdot 16 + 14 = 126_{10}$$

Correct.

Example 3

Now let us do long multiplication with two hexadecimal numbers:

$$1F_{16} \times 2A_{16}$$

This works just like decimal long multiplication. Multiply $1F$ by the rightmost digit of $2A$, which is $A$, then multiply by the next digit $2$, remembering that the $2$ is really in the sixteens place.

First partial product:

$$1F_{16} \times A_{16}$$

Since $1F_{16} = 31_{10}$ and $A = 10$, we get $31 \times 10 = 310$ decimal. Convert $310$ to hexadecimal:

$$310 = 1 \cdot 16^2 + 3 \cdot 16 + 6$$

So:

$$1F_{16} \times A_{16} = 136_{16}$$

Second partial product:

$$1F_{16} \times 2_{16} = 3E_{16}$$

But because this $2$ is actually in the next place, we shift left one hexadecimal place, giving:

$$3E0_{16}$$

Now add the partial products:

$$136_{16} + 3E0_{16} = 516_{16}$$

So:

$$1F_{16} \times 2A_{16} = 516_{16}$$

Let us check. $1F_{16} = 31_{10}$ and $2A_{16} = 42_{10}$. Then:

$$31 \times 42 = 1302$$

Now convert $516_{16}$ to decimal:

$$5 \cdot 16^2 + 1 \cdot 16 + 6 = 1280 + 16 + 6 = 1302$$

Correct again.

Hexadecimal Division

Now let us study division.

Hexadecimal division is the same idea as decimal long division, except everything is in base $16$. If that feels hard, that is normal. Division is usually the most difficult operation in any number system. The good news is that if you stay organized, it becomes easier.

Example 1

Let us begin with a simple one:

$$24_{16} \div 2_{16}$$

You can think in decimal first if needed. $24_{16} = 36_{10}$. Then $36 \div 2 = 18$ decimal. Convert $18$ back to hexadecimal:

$$18 = 1 \cdot 16 + 2$$

So:

$$24_{16} \div 2_{16} = 12_{16}$$

Now let us do one where the quotient is a single hexadecimal digit:

$$3C_{16} \div 6_{16}$$

Convert to decimal if helpful. $3C_{16} = 60_{10}$ and $6_{16} = 6_{10}$. Then $60 \div 6 = 10$ decimal, which is $A$ in hexadecimal.

$$3C_{16} \div 6_{16} = A_{16}$$

Example 2

Now let us try a long division style example:

$$84_{16} \div 4_{16}$$

Look at the first digit. $8 \div 4 = 2$, so write $2$ above the $8$. Then $2 \times 4 = 8$, subtract, and bring down the next digit $4$. Then $4 \div 4 = 1$. So the quotient is:

$$84_{16} \div 4_{16} = 21_{16}$$

Check in decimal: $84_{16} = 132_{10}$, and $132 \div 4 = 33$. Also $21_{16} = 33_{10}$.

Now let us try division with a remainder:

$$2F_{16} \div 5_{16}$$

Convert to decimal if needed. $2F_{16} = 47_{10}$ and $5_{16} = 5_{10}$. Then $47 \div 5 = 9$ remainder $2$. Since both $9$ and $2$ are valid hexadecimal digits, the answer is:

$$2F_{16} \div 5_{16} = 9_{16} \text{ remainder } 2_{16}$$

You can also check with multiplication:

$$5_{16} \times 9_{16} + 2_{16} = 2F_{16}$$

That last equation shows an important rule of division. In any base, division can be checked using:

$$\text{Dividend} = \text{Divisor} \times \text{Quotient} + \text{Remainder}$$

Example 3

Now let us do a more thoughtful long-division example:

$$7B_{16} \div A_{16}$$

Since $A = 10$, this means $123 \div 10$ in decimal, because $7B_{16} = 123_{10}$. That gives quotient $12$ remainder $3$ in decimal. Now convert decimal $12$ to hexadecimal $C$.

So:

$$7B_{16} \div A_{16} = C_{16} \text{ remainder } 3_{16}$$

Let us verify:

$$A_{16} \times C_{16} + 3_{16} = 78_{16} + 3_{16} = 7B_{16}$$

Very good.

At this point, you may be wondering whether you always have to convert to decimal. No. In fact, the goal is to learn to work directly in hexadecimal. But at the beginning, converting to decimal is a very smart checking method. It helps you know whether your hexadecimal answer makes sense.

Here are the most important habits for working directly in hexadecimal.

You should memorize the digit values from $A$ to $F$. If you must keep stopping to remember that $D = 13$, the work becomes slow. You should also get comfortable with the idea that carrying happens at $16$ and borrowing means adding $16$.

For addition, whenever a column total reaches $16$ or more, carry $1$ to the next place.

For subtraction, whenever the top digit is too small, borrow $1$ from the next place, which adds $16$ to the current place.

For multiplication, multiply digit values as usual, then convert the product back into hexadecimal.

For division, use the same logic as long division in decimal, but think in hexadecimal groups and check with multiplication.

It also helps to know hexadecimal place values:

$$16^0 = 1$$
$$16^1 = 16$$
$$16^2 = 256$$
$$16^3 = 4096$$

So a number like $3A5_{16}$ means:

$$3A5_{16} = 3 \cdot 16^2 + 10 \cdot 16 + 5$$

That becomes:

$$3A5_{16} = 3 \cdot 256 + 160 + 5 = 933_{10}$$

Understanding place value makes the arithmetic much easier.

Conclusion

So hexadecimal math is ordinary arithmetic done in base $16$ instead of base $10$. If you remember the digit values, the place values, and the base $16$ carrying and borrowing rules, you can do addition, subtraction, multiplication, and division confidently.

Amrit Prabhu

Amrit Prabhu

Amrit is an Electronics Engineer who loves making complex programming and hardware concepts accessible. He has more than 15 years of experience, having worked as a Senior Programmer Analyst at Mindtree Ltd. and Symantec on major projects like Windows 8, Wolters Kluwer CCH and NSE. Since 2018, he has authored hundreds of tutorials and guides for Last Minute Engineers, helping readers master everything from basic circuits to IoT. You can find him on LinkedIn