Skip to the tool
Binary Translator Free tools

Hex calculator

A hexadecimal calculator for arithmetic and bitwise operations on hex numbers, with binary and decimal results.

Updated · Written and checked by Murugan Vellaichamy

Waiting for input
Result ()

Adding in hex

Add each column from the right. When a column reaches 16 or more, write the amount over 16 and carry 1. For example 9 + 8 = 17, which is 11 in hex: write 1, carry 1. A + 7 = 17 as well, so it also gives 11.

The example above adds 7F + 1 in 8 bits. The unsigned answer is 80 (128), but as a signed 8-bit number 7F is the largest positive value, 127, so adding 1 wraps to −128. The calculator flags that as signed overflow.

Where hex arithmetic comes up

TaskExample
Memory address offsets0x1000 + 0x20 = 0x1020
Masking bits0xDEAD AND 0x00FF = 0xAD
Setting flags0x04 OR 0x01 = 0x05
Toggling bits0xF0 XOR 0xFF = 0x0F
Colour channels0xFF8000 shifted right by 8 = 0xFF80

Common mistakes

Carrying at 10

9 + 8 written as 17 instead of 11 (one 16, plus 1)

Instead: A column only carries when it reaches 16

Reading the answer as decimal

Seeing 20 and thinking twenty; 0x20 is 32

Instead: Check the decimal line under the result

Ignoring the bit width

7F + 1 in 8 bits is 80, which is −128 when signed

Instead: Pick the width your program uses and watch the overflow flags

How it’s calculated

Results use exact whole-number arithmetic at any size. With a bit width chosen, the result is wrapped to that width the way a CPU register does, and overflow is checked separately for unsigned and signed (two’s complement) readings.

Questions

Do I need to type 0x?

No. The prefix is accepted but not needed.

Why is 7F + 1 negative?

In a signed 8-bit register the largest value is 7F (127). One more wraps around to 80, which reads as −128 in two’s complement.

Can it work with numbers bigger than 64 bits?

Yes, with the width set to “No limit”. The arithmetic is exact at any size.

More converters

Copied