HomeMath › Hex Calculator

Hex Calculator

Do arithmetic directly in base 16 — add, subtract, multiply, or divide two hex values — or convert any number between hexadecimal, decimal, and binary. Every result shows the decimal working so you can follow along.

Hex result
Decimal
Binary
Steps

How hexadecimal works

Hex is base 16: digits run 0–9 then A–F (10–15), and each place is worth sixteen times the one to its right. Its superpower is that one hex digit maps to exactly four binary bits, so any byte is two hex digits — 11110100 is F4 — which is why memory dumps, color codes, and MAC addresses are written in hex. Arithmetic follows the same column rules as decimal, just carrying at 16: F + 1 = 10₁₆.

How it’s calculated

Inputs are parsed as arbitrary-precision integers, the operation is applied exactly, and the result is rendered in hex, decimal, and binary. Division returns the integer quotient and remainder. Conversion between bases is exact re-rendering of the same integer — nothing is rounded.

Values are treated as unsigned magnitudes; negative differences display with a minus sign rather than a two’s-complement wrap.

Worked example

A3F + B2: in decimal, A3F₁₆ = 2,623 and B2₁₆ = 178. Adding gives 2,801, which converts back to AF1₁₆ (binary 101011110001). Conversions work the same way: 1F4₁₆ = 1×256 + 15×16 + 4 = 500, and FF × 10₁₆ = FF0 (255 × 16 = 4,080).

Common mistakes

  • Reading 10₁₆ as ten — in hex it is sixteen. Base prefixes (0x10) exist for exactly this reason.
  • Carrying at 10 instead of 16 when adding by hand.
  • Mixing up letter values (B = 11, not 12 — count from A = 10).
  • Treating a hex color or address as decimal when copying into code or a spreadsheet.

Where it is used

  • Programming and debugging: memory addresses, byte values, and opcodes.
  • Web design: #RRGGBB color codes are three hex byte pairs.
  • Networking: MAC addresses and IPv6 are written in hex.
  • Computer-science coursework on number bases.

Frequently asked questions

What do the letters A to F mean in hex?

Hexadecimal is base 16, so it needs sixteen digits: 0–9 plus A=10, B=11, C=12, D=13, E=14, F=15. Each place is worth 16 times the one to its right, so A3F = 10×256 + 3×16 + 15 = 2,623.

How do I convert hex to decimal?

Multiply each digit by its power of 16 and add. 1F4 = 1×256 + 15×16 + 4×1 = 500. Converting back, divide the decimal number by 16 repeatedly and read the remainders bottom-up as hex digits.

Why is hex so common in computing?

One hex digit represents exactly four binary bits, so a byte is always two hex digits (11110100 = F4). That makes hex a compact, human-readable shorthand for binary — memory addresses, color codes like #1557C0, and MAC addresses all use it.

Does the calculator handle subtraction that goes negative?

Yes — B2 − A3F gives −98D, shown with a minus sign. Fixed-width machine registers would instead wrap around using two’s complement; see the binary calculator for that representation.

What happens with hex division?

It performs integer division and reports both quotient and remainder in hex and decimal. A3F ÷ B2 = E remainder 83 (2,623 ÷ 178 = 14 r 131 in decimal).