Hex Calculator

Convert hexadecimal (base 16) to decimal, binary, and octal, or convert any number into hex. Also supports base conversions between any bases from 2 to 36.

Guides & Reference

How It Works

Hex DigitsUnderstanding base 16

Hex has 16 digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. After 9, use letters: A=10, B=11, C=12, D=13, E=14, F=15.

0-9, A(10), B(11), C(12), D(13), E(14), F(15)FF: F=15, so FF = 15×16 + 15 = 255
Hex to DecimalPosition values

Multiply each digit by 16^position. Rightmost is 16⁰=1, next is 16¹=16, then 16²=256, etc. Sum all products.

Sum of (digit × 16^position)2A: 2×16+10×1 = 32+10 = 42
Decimal to HexRepeated division

Divide by 16, record remainders. If remainder ≥ 10, replace with letter. Read remainders bottom to top.

Divide by 16, collect remainders42: 42/16=2 R10(A) → 2A
Hex and Binary4-bit groups

Each hex digit maps to exactly 4 binary bits. Convert each hex digit independently to 4-bit binary and concatenate.

1 hex digit = 4 bitsFA: F=1111, A=1010 → 11111010
Hex Color CodesWeb development

CSS colors #RRGGBB use two hex digits per channel. Each pair 00-FF represents intensity 0-255 for Red, Green, Blue.

#RRGGBB = 3 hex pairs#FF5733: R=255, G=87, B=51
Memory AddressesComputing

Memory addresses in computing are written in hex. 0x7FFFFFFF is a 32-bit address. The 0x prefix indicates hex.

0x prefix for hex in code0xFF = 255, 0x100 = 256

Quick Reference

Common examples — verify instantly above.

Hex→Dec

FF

255

Hex→Dec

2A

42

Hex→Dec

1F4

500

Dec→Hex

255

FF

Dec→Hex

42

2A

Dec→Hex

256

100

Hex→Bin

FA

11111010

Color

#FF0000

R=255,G=0,B=0

Tips & Shortcuts

✓

Memorize: A=10, B=11, C=12, D=13, E=14, F=15. These are the only new symbols in hex.

✓

Each hex digit = 4 binary bits. FF = 1111 1111 = 255. This makes hex a perfect shorthand for binary.

✓

Web colors use hex: #FFFFFF = white, #000000 = black, #FF0000 = red, #00FF00 = green, #0000FF = blue.

✓

A byte is 8 bits = 2 hex digits = values 00 to FF (0-255). This is why image channels use 256 values.

✓

The prefix 0x in code means hex: 0xFF = 255, 0x1A = 26. Some code uses # or h prefix instead.

✓

Hex 10 = decimal 16, hex 100 = decimal 256, hex 1000 = decimal 4096. Powers of 16.

Common Mistakes

✕

Reading hex F as 0 or ignoring it

F is a valid digit equal to 15. Never skip or zero-out letter digits.

✕

Multiplying by 10 instead of 16 when converting

Hex is base 16, not 10. Position values are 1, 16, 256, 4096... not 1, 10, 100, 1000.

✕

Grouping binary in 3s instead of 4s for hex conversion

Hex requires groups of 4 bits. Octal uses groups of 3. Use 4-bit groups when converting to hex.

✕

Forgetting the 0x prefix in code

When writing hex values in code (C, Python, JavaScript), prefix with 0x. 255 ≠ 0xFF without the prefix.

✕

Treating hex letters as case-sensitive

Hex digits are not case-sensitive. 0xFF = 0XFF = 0xff. All are equivalent.

✕

Confusing hex color channels

In #RRGGBB, first pair is Red, second Green, third Blue. #FF0000 is red, not blue.

Frequently Asked Questions

Hexadecimal is base 16. Digits are 0-9 and A-F, where A=10, B=11, C=12, D=13, E=14, F=15.

Hex is a compact representation of binary. Each hex digit equals exactly 4 binary bits, making it easy to read memory addresses and color codes.

#FF0000 is an RGB color: R=FF=255, G=00=0, B=00=0 → pure red in decimal RGB (255, 0, 0).

Multiply each digit by 16^position and sum. FF = 15×16¹ + 15×16⁰ = 240+15 = 255.

FF = 255 in decimal. One hex byte (2 digits) ranges from 00 to FF (0 to 255).

#RRGGBB where each pair is a hex value 00-FF. #FFFFFF=white, #000000=black, #FF5500=orange.

A hex color like #FF5733 has three pairs: FF (red), 57 (green), 33 (blue). Each pair is a hex byte (00 to FF), representing 0–255 in decimal. FF = 255 (maximum intensity), 00 = 0 (none). So #FF5733 = RGB(255, 87, 51) — maximum red, medium-low green, low blue = orange-red. #000000 is black (all zero). #FFFFFF is white (all maximum). #808080 is 50% gray (128,128,128).

Related Calculators