Hex Calculator
Convert between hexadecimal, decimal, binary, and octal number systems.
Hexadecimal Calculator
Enter a whole number (0-16777215)
Hex Reference
Decimal
Base 10
Hexadecimal
Base 16
Binary
Base 2
Octal
Base 8
Hex Details
Powers of 16
How it works
Hexadecimal is base-16, using digits 0–9 then A–F for ten through fifteen. It's a compact way to write binary because each hex digit equals exactly four bits. This calculator converts between hex, decimal, and binary and does hex arithmetic.
Hex to decimal
Decimal = Σ (digit value × 16^position) A=10, B=11, …, F=15
- digit value
- 0–15 (A–F = 10–15)
- 16^position
- place value (1, 16, 256, …)
Worked example
- Convert hex 1F to decimal
- 1×16 + 15×1
1F₁₆ = 31 in decimal.
Good to know
- One hex digit = 4 bits, so two hex digits = one byte — which is why colors are written like #FF8800.
- Hex is common for memory addresses, color codes, and MAC addresses.
- Prefixes signal the base: 0x for hex, 0b for binary.
Related Calculators
Frequently Asked Questions
What is hexadecimal?
Hexadecimal (hex) is a base-16 number system using digits 0-9 and letters A-F, where A = 10 through F = 15. Each hex digit represents exactly four binary bits, which is why hex is the standard shorthand for binary data.
How do I convert hex to decimal?
Multiply each digit by 16 raised to its position power (rightmost = 16⁰) and sum. For 1A3: 1×256 + 10×16 + 3×1 = 419. Going the other way, repeatedly divide the decimal number by 16 and read the remainders in reverse.
Why is hex used in programming?
One hex digit maps cleanly to 4 bits, so a byte is exactly two hex digits — far more compact and readable than binary. Memory addresses, color codes, MAC addresses, and raw data dumps are conventionally written in hex for this reason.
How does hex addition work?
Add digits column by column just like decimal, but carry when a column reaches 16 instead of 10. For example, 9 + 8 = 17 in decimal, which is 11 in hex (one 16 plus 1). The calculator handles carries across all columns automatically.
How do hex color codes work?
A web color like #FF5733 is three hex byte pairs for red, green, and blue, each from 00 (0) to FF (255). #FF5733 means red 255, green 87, blue 51 — a vivid orange. Equal pairs like #808080 produce grays.