# Hex Calculator

> Add, subtract, multiply, divide and do bitwise AND, OR and XOR on hexadecimal numbers, with results in hex, decimal and binary.

Category: Algebra, geometry & advanced math · Applies to: Worldwide · Last updated: 2026-10-29
Interactive calculator: https://calculators.geekmidst.com/calculators/hex-calculator

Enter two hexadecimal numbers (0–9 and A–F) and an operation. The answer is exact and also shown in decimal and binary.

Also called: Hexadecimal calculator, Base-16 calculator.

## Inputs
- First hex number (default FF)
- Operation (options: Add (+), Subtract (−), Multiply (×), Divide (÷, whole-number), AND, OR, XOR; default +)
- Second hex number (default 1)

## Results
- Result (hex)
- Result in decimal
- Result in binary
- Remainder (division only)
- First number in decimal
- Second number in decimal

## Formula

```
Value = Σ dᵢ × 16ⁱ, with digits 0–9 and A = 10, B = 11, C = 12, D = 13, E = 14, F = 15;  the operation is done on the exact integers
```

Where:
- dᵢ: the hex digit in position i, counted from 0 at the right

## Worked example
1. FF = 15 × 16 + 15 = 255.
2. 255 + 1 = 256 = 1 × 16², which is 100 in hex.
3. In binary, 256 = 2⁸ = 100000000.

**Result:** FF + 1 = 100 in hexadecimal, or 255 + 1 = 256 in decimal.

## What the result means

Each hex digit stands for exactly four bits, which is why hex is used for memory addresses, colour codes (#FF8800) and byte values.

## Assumptions and limits
- Inputs are unsigned hexadecimal integers; upper or lower case and a 0x prefix are accepted.
- Negative results are shown with a minus sign, not in two’s complement.
- Division gives a whole-number quotient and a remainder.

## Questions

### How do I convert hex to decimal?

Multiply each digit by a power of 16 from the right (1, 16, 256, 4096, …) and add. 1A = 1 × 16 + 10 = 26.

### Why is one byte two hex digits?

A byte has 8 bits and each hex digit encodes 4 bits, so 00 to FF covers all 256 byte values.

## Related calculators
- [Binary Calculator](https://calculators.geekmidst.com/calculators/binary-calculator)
- [Exponent Calculator](https://calculators.geekmidst.com/calculators/exponent-calculator)
- [Log Calculator](https://calculators.geekmidst.com/calculators/log-calculator)

Source: GM¹X CalcVerse — https://calculators.geekmidst.com/calculators/hex-calculator
