Hex Calculator

Convert between hexadecimal, decimal, binary, and octal number systems.

Hexadecimal Calculator

Enter a whole number (0-16777215)

Hex Reference

Dec
Hex
Dec
Hex
10
A
16
10
11
B
17
11
12
C
18
12
13
D
19
13
14
E
20
14
15
F
21
15

Decimal

255

Base 10

Hexadecimal

FF

Base 16

Binary

11111111

Base 2

Octal

377

Base 8

Hex Details

Uppercase:FF
Lowercase:ff
With 0x prefix:0xFF
Formatted:FF

Powers of 16

16¹ = 16 (10₁₆)
16⁴ = 65,536 (10000₁₆)
16² = 256 (100₁₆)
16⁵ = 1,048,576 (100000₁₆)
16³ = 4,096 (1000₁₆)
16⁶ = 16,777,216 (1000000₁₆)

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. 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.