Hex Calculator
Add, subtract, multiply, and divide hexadecimal numbers with conversions to decimal and binary.
Result
What is a Hex Calculator?
A hex calculator performs arithmetic — addition, subtraction, multiplication, and division — on hexadecimal (base-16) numbers and shows every result in hex, decimal, and binary at once. It is a daily tool for programmers, web developers, and students working with memory addresses, color codes, and byte values.
Hexadecimal appears everywhere in computing because it maps cleanly onto binary: one hex digit represents exactly four bits, so a full byte takes exactly two hex digits. Doing math on hex values by hand is error-prone because carries and borrows happen at 16 instead of 10; this calculator applies the base-16 rules and prints the intermediate decimal step.
Type two hex numbers, pick an operation, and the tool converts each operand to decimal, applies the operation, and converts the answer back — all locally in your browser.
How Hexadecimal Arithmetic Works
Hexadecimal is positional, just like decimal, except each place is worth a power of 16 instead of a power of 10. The digits run 0–9 and then A–F, where A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15. To convert to decimal, multiply each digit by its place value and add:
Decimal Value = d₀×16⁰ + d₁×16¹ + d₂×16² + … (digits numbered from the right)
Result = (decimal value of Hex Number 1) operation (decimal value of Hex Number 2), converted back to base 16
- Hex Number 1 — the first operand, written with digits 0–9 and letters A–F. Lowercase works too, and a leading 0x is optional.
- Operation — addition (+), subtraction (−), multiplication (×), or division (÷).
- Hex Number 2 — the second operand, entered the same way; it cannot be zero when dividing.
Worked Example: 0x1A3F + 0x0B2
Suppose you add two values from a hex dump, 1A3F and 0B2. First convert each to decimal:
- 1A3F: 1×4096 + 10×256 + 3×16 + 15 = 4096 + 2560 + 48 + 15 = 6719
- 0B2: 0×256 + 11×16 + 2 = 176 + 2 = 178
Add the decimal values: 6719 + 178 = 6897. You can also add directly in hex, column by column from the right: F + 2 = 15 + 2 = 17, which is 11 in hex, so write down 1 and carry 1; then 3 + B + 1 = 3 + 11 + 1 = 15, which is the digit F with no carry; the remaining columns give A + 0 = A and 1 + 0 = 1. Either way, the sum is 0x1AF1.
To convert 6897 back to hex, divide by decreasing powers of 16: 6897 ÷ 4096 = 1 remainder 2801; 2801 ÷ 256 = 10 (the digit A) remainder 241; 241 ÷ 16 = 15 (the digit F) remainder 1. The digits read off as 1AF1, matching the column addition. For the binary form, replace each hex digit with its four-bit pattern — 1 = 0001, A = 1010, F = 1111, 1 = 0001 — giving 0001 1010 1111 0001, written without the leading zeros as 1101011110001. The calculator shows all three forms — 0x1AF1, 6897, 1101011110001 — plus the step line 6719 + 178 = 6897.
Hex Digit Quick Reference
Each hex digit with its decimal value and four-bit binary pattern:
| Hex | Decimal | Binary | Hex | Decimal | Binary |
|---|---|---|---|---|---|
| 0 | 0 | 0000 | 8 | 8 | 1000 |
| 1 | 1 | 0001 | 9 | 9 | 1001 |
| 2 | 2 | 0010 | A | 10 | 1010 |
| 3 | 3 | 0011 | B | 11 | 1011 |
| 4 | 4 | 0100 | C | 12 | 1100 |
| 5 | 5 | 0101 | D | 13 | 1101 |
| 6 | 6 | 0110 | E | 14 | 1110 |
| 7 | 7 | 0111 | F | 15 | 1111 |
Powers of 16
Place values grow quickly in base 16; these powers drive every hex-to-decimal conversion:
| Power | 16⁰ | 16¹ | 16² | 16³ | 16⁴ |
|---|---|---|---|---|---|
| Value | 1 | 16 | 256 | 4,096 | 65,536 |
How to Use
- Type the first hexadecimal number into Hex Number 1 (for example 1A3F).
- Choose an Operation: Addition, Subtraction, Multiplication, or Division.
- Type the second number into Hex Number 2 (for example 0B2).
- Click Calculate to see the result in hex, decimal, and binary plus the decimal step line.
- Click Reset to clear the fields and start over.
Frequently Asked Questions
What is hexadecimal?
Hexadecimal is a base-16 number system using digits 0–9 and letters A–F for values 10–15; each position is worth a power of 16. For example, FF means 15×16 + 15 = 255, and 100 in hex means 1×256 = 256 in decimal.
How do I convert hex to decimal by hand?
Multiply each digit by 16 raised to its position, counting from the right starting at zero, then add the results. For 2F: 2×16 + 15 = 47. For a longer value like 1A3F: 1×4096 + 10×256 + 3×16 + 15 = 6719.
Why do programmers use hexadecimal?
One hex digit represents exactly four bits, so one byte always takes exactly two hex digits — FF is 11111111 in binary and 255 in decimal. That tight mapping makes hex the standard notation for memory addresses, byte values, and color codes such as #FF8000.
Is the result case-sensitive?
Inputs are case-insensitive, so 1a3f and 1A3F are the same number. Results are displayed in uppercase for consistency.
Can I use the 0x prefix?
The 0x prefix is optional. The calculator accepts 0x1A3F and 1A3F alike, strips the prefix, and prints results with a 0x in front for clarity.
What happens when hex division has a remainder?
The calculator shows the exact fractional result in all three bases. For example, 0xA ÷ 0x4 is 10 ÷ 4 = 2.5 in decimal, which appears as 0x2.8 in hex (because 8/16 = 0.5) and 10.1 in binary. Division by zero is not allowed and triggers a warning.
Is this calculator free to use?
Yes, all BestCalc calculators are free and run locally in your browser, so your inputs never leave your device.