Hex Calculator

Do arithmetic directly in hexadecimal and convert between hex, decimal, binary, and octal. Results are exact at any practical size, update as you type, and never leave your browser.

Hexadecimal arithmetic

Example: 2F + 1A = 49.

Enter two hex values to see the result.

Hex → decimal, binary, octal

Example: FF is 255 in decimal.

Enter a hex value to convert it.

Decimal → hex

Example: 255 is FF in hex.

Enter a whole decimal number to convert it.

How hexadecimal works

Hexadecimal is base 16: each digit represents sixteen values, using 0–9 and then A–F for ten through fifteen. Where a decimal digit column steps ×10, a hex column steps ×16 — so 2F means 2 × 16 + 15 = 47, and FF means 15 × 16 + 15 = 255.

Hex matters to programmers because 16 is 24: one hex digit is exactly four bits (a nibble), and two hex digits are exactly one byte. That makes hex a compact, lossless way to write binary data — DEADBEEF is 32 bits (3,735,928,559 in decimal) written in eight characters. You meet it in memory addresses, CSS colors (#FF6600), MAC addresses, hash digests, and file dumps.

Arithmetic and integer division

Hex arithmetic is ordinary integer arithmetic — only the notation differs. This calculator computes exactly with big integers and shows the decimal equivalent alongside each result. Division is integer division: 0x64 ÷ 0x7 gives quotient 0xE with remainder 0x2, the same convention as programmers' calculators and the / and % operators in most languages.

Converting by hand

Hex → decimal: multiply each digit by its power of 16 and add. Decimal → hex: repeatedly divide by 16 and read the remainders in reverse. Hex ↔ binary needs no arithmetic at all — replace each hex digit with its 4-bit pattern: 2F0010 1111. That shortcut is why low-level debugging happens in hex rather than decimal.

Frequently asked questions

Are hex digits case-sensitive?

No. A–F and a–f mean the same values (10–15). This calculator accepts either and displays results in uppercase, which is the common convention in documentation.

Can hexadecimal numbers be negative?

As plain numbers, yes — this calculator uses a minus sign, so -FF is -255. Inside a CPU register, negative values are instead stored in two’s-complement form, which depends on a fixed bit width (8, 16, 32, or 64 bits); that representation is a different question from the arithmetic itself.

Why does division show a remainder?

This is an integer calculator, matching how programmers’ calculators work: 0x64 ÷ 0x7 gives quotient 0xE with remainder 0x2 rather than a fraction. Quotient × divisor + remainder always equals the original value.

How large can the numbers be?

Up to 256 hex digits — over 1,000 bits. The math uses exact big-integer arithmetic, so there is no rounding at any size, unlike calculators that convert through floating point.

All values are processed locally in your browser and never transmitted. Formulas are implemented as tested, typed functions — see the methodology page.