Skip to main content
HexConverter

Hexadecimal Calculator & Bitwise Tool

Perform base-16 arithmetic (+, -, *, /) and bitwise logic (AND, OR, XOR, NOT, left/right shifts) with simulated 8, 16, 32, and 64-bit hardware register overflow.

Word Size (Overflow Mask):
Samples:
Calculation Result (32-bit)
0x100
Decimal Equivalent:
256
Binary Equivalent:
00000000000000000000000100000000
Runs 100% in your browser. Nothing you enter is sent over the network.

Hexadecimal Arithmetic & Bitwise Logic Principles

Calculations in hexadecimal mirror digital ALU (Arithmetic Logic Unit) hardware in central processing units:

  • Addition (+): When column totals equal or exceed 16, a carry of 1 is propagated to the left. E.g., 0x0F + 0x01 = 0x10.
  • Subtraction (-): Borrowing from the next column brings over a value of 16 (not 10). E.g., 0x10 - 0x01 = 0x0F.
  • Bitwise AND (&): Yields 1 only where both bits are 1. Commonly used for bitmasking and extracting specific byte flags.
  • Bitwise OR (|): Yields 1 if either bit is 1. Used to turn on specific configuration flags.
  • Bitwise XOR (^): Yields 1 if bits differ. Used for toggling bits and lightweight cryptographic mixing.

To learn more about negative signed values, read our guide: Two's Complement Explained.

Verified Calculation Test Vectors

Addition: FF + 1

Input:0xFF + 0x01
→
Result:0x100 (Decimal 256)

Rolls over the 8-bit byte into a 9th carry bit.

15 + 1 = 16 -> 0 carry 1
15 + 1 = 16 -> 0 carry 1
Result: 0x100

Addition: 3F + 64

Input:0x3F + 0x64
→
Result:0xA3 (Decimal 163)

Two multi-digit operands without overflow.

F(15) + 4 = 19 -> 3 carry 1
3 + 6 + 1(carry) = 10 (A)
Result: 0xA3

Subtraction: 10 - 1

Input:0x10 - 0x01
→
Result:0x0F (Decimal 15)

Demonstrates borrowing 16 from the high column.

Borrow 16 into low column
16 - 1 = 15 (F)
High column becomes 0 -> Result: 0x0F

Multiplication: 1F * 3

Input:0x1F * 0x03
→
Result:0x5D (Decimal 93)

31 * 3 = 93 in base 10.

15 * 3 = 45 = (2 * 16) + 13(D)
1 * 3 + 2(carry) = 5
Result: 0x5D

Bitwise XOR: A5 XOR 5A

Input:0xA5 XOR 0x5A
→
Result:0xFF

Alternating bit pattern produces all ones.

10100101 XOR
01011010 =
11111111 (0xFF)

Bitwise AND: F0 AND 3C

Input:0xF0 AND 0x3C
→
Result:0x30

Extracts overlapping bits.

11110000 AND
00111100 =
00110000 (0x30)

Frequently Asked Questions

Direct answers to technical and practical questions regarding this tool and base-16 conversion.

How do you add hexadecimal numbers?

Hexadecimal addition follows the same column addition rules as decimal math, but carries occur at sixteen instead of ten. If the sum of a column is 16 or greater, subtract 16 to find the current digit and carry 1 to the next column to the left. For example, 0x0F + 0x01: 15 + 1 = 16 → digit 0, carry 1 → 0x10.

What is bitwise XOR in hexadecimal?

Bitwise XOR (exclusive OR) compares corresponding bits of two hexadecimal numbers. For each bit position, the result bit is 1 if exactly one of the input bits is 1, and 0 if both bits are the same. For example, 0xA5 (10100101) XOR 0x5A (01011010) results in 0xFF (11111111) because every pair of bits differs.

How does bit-width masking work in this calculator?

When a specific word size is selected (such as 8-bit or 32-bit), the calculator simulates computer hardware registers by truncating results that exceed the bit width (overflow). For instance, in an 8-bit register, 0xFF + 1 = 0x100 wraps around to 0x00 with an overflow flag.

How do bitwise shift operators (SHL and SHR) work on hex numbers?

A left shift (SHL / <<) moves bits to the left, which is mathematically equivalent to multiplying by powers of 2. Shifting left by 4 bits shifts the number by one entire hexadecimal digit (multiplying by 16). A right shift (SHR / >>) moves bits to the right, dividing by powers of 2.

Related Conversion Tools & Resources

Explore companion converters, bitwise arithmetic calculators, and reference charts.

Sources & Technical References

Technical Verification & Editorial Accountability

Written by Sarah Chen (Embedded Systems Engineer) • Verified by Marcus Brody, PE

Reviewed: 2026-10-02MethodologyEditorial PolicyReport Error