How to Convert Hex to Decimal (Manual Method, Examples, and Quick Reference)
If you've ever stared at a memory address like 0x1A3F, a CSS color like #FF6B00, or an IPv6 segment like fe80, you've been looking at hexadecimal. Knowing how to convert hex to decimal by hand — or at least understanding the mechanics behind the conversion — is a foundational skill for anyone working in systems programming, networking, or security.
This guide walks through the positional notation method step by step, works through several concrete examples, and gives you a quick reference table for the single-digit hex values you'll encounter most often.
What Is Hexadecimal?
Hexadecimal (hex) is a base-16 number system. Unlike decimal (base-10), which uses the digits 0–9, hexadecimal uses 16 symbols: the digits 0–9 and the letters A–F.
| Hex | Decimal |
|---|---|
| 0 | 0 |
| 1 | 1 |
| ... | ... |
| 9 | 9 |
| A | 10 |
| B | 11 |
| C | 12 |
| D | 13 |
| E | 14 |
| F | 15 |
The letters are case-insensitive — FF, ff, and Ff all represent the same value.
Why Hex Is Used in Computing
Hex is compact and maps cleanly onto binary. Every single hex digit represents exactly 4 bits (a nibble), and every two hex digits represent exactly 1 byte. This makes it far more readable than raw binary while being unambiguous.
You'll see hex used in:
- Memory addresses —
0x7fff5fbff8c0in a debugger output - CSS colors —
#1a1a2ein your stylesheet - IPv6 addresses —
2001:0db8:85a3:0000:0000:8a2e:0370:7334 - Byte values —
0xFFmeaning 255, often used in bitmask operations - File magic bytes —
89 50 4E 47at the start of every PNG file - Cryptographic output — SHA-256 hashes are typically displayed as 64 hex characters
The Positional Notation Method
Every number system works on positional notation — the value of a digit depends on its position. In decimal, positions represent powers of 10 (1s, 10s, 100s, ...). In hex, positions represent powers of 16.
The formula is:
decimal = d_n × 16^n + d_(n-1) × 16^(n-1) + ... + d_1 × 16^1 + d_0 × 16^0
Where d is the decimal value of each hex digit and the rightmost digit is position 0.
Worked Examples
Example 1: FF
This is the most common hex value you'll encounter — it represents the maximum value of a single byte.
F = 15, F = 15
Position 1 (leftmost): 15 × 16^1 = 15 × 16 = 240
Position 0 (rightmost): 15 × 16^0 = 15 × 1 = 15
Total: 240 + 15 = 255
FF in hex = 255 in decimal.
Example 2: 10
This one catches people off guard. In hex, 10 does not mean ten.
1 = 1, 0 = 0
Position 1: 1 × 16^1 = 1 × 16 = 16
Position 0: 0 × 16^0 = 0 × 1 = 0
Total: 16 + 0 = 16
10 in hex = 16 in decimal — the first value that requires two hex digits.
Example 3: 2B
2 = 2, B = 11
Position 1: 2 × 16^1 = 2 × 16 = 32
Position 0: 11 × 16^0 = 11 × 1 = 11
Total: 32 + 11 = 43
2B in hex = 43 in decimal.
Example 4: 1A3F
A four-digit value — common in port numbers, color components, and memory offsets.
1 = 1, A = 10, 3 = 3, F = 15
Position 3: 1 × 16^3 = 1 × 4096 = 4096
Position 2: 10 × 16^2 = 10 × 256 = 2560
Position 1: 3 × 16^1 = 3 × 16 = 48
Position 0: 15 × 16^0 = 15 × 1 = 15
Total: 4096 + 2560 + 48 + 15 = 6719
1A3F in hex = 6719 in decimal.
Quick Reference Table: Hex 0–F
| Hex | Decimal | Binary |
|---|---|---|
| 0 | 0 | 0000 |
| 1 | 1 | 0001 |
| 2 | 2 | 0010 |
| 3 | 3 | 0011 |
| 4 | 4 | 0100 |
| 5 | 5 | 0101 |
| 6 | 6 | 0110 |
| 7 | 7 | 0111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
Memorize this table and you can decode any hex string manually.
How to Convert Hex to Decimal in Code
You almost never need to do this by hand in practice. Every major language handles it natively.
Python
# Using int() with base argument
print(int("1A3F", 16)) # 6719
print(int("FF", 16)) # 255
print(int("10", 16)) # 16
# Using the 0x prefix directly
value = 0x1A3F
print(value) # 6719
JavaScript
// parseInt with radix 16
console.log(parseInt("1A3F", 16)); // 6719
console.log(parseInt("FF", 16)); // 255
console.log(parseInt("10", 16)); // 16
// Number() with 0x prefix
console.log(Number("0x1A3F")); // 6719
Bash
# printf with %d format reads hex with 0x prefix
printf "%d\n" 0x1A3F # 6719
printf "%d\n" 0xFF # 255
# Using $((…)) arithmetic expansion
echo $((16#1A3F)) # 6719
echo $((16#FF)) # 255
Common Values Worth Memorising
These show up constantly in networking, security, and systems work:
| Hex | Decimal | Context |
|---|---|---|
FF |
255 | Max byte value, broadcast mask |
7F |
127 | Loopback IP (127.0.0.1) |
80 |
128 | HTTP port |
1BB |
443 | HTTPS port |
539 |
1337 | "Leet" — also a valid port |
FFFF |
65535 | Max unsigned 16-bit value |
DEAD |
57005 | Common magic/debug value |
BEEF |
48879 | Dead Beef — debug sentinel |
Use the Tool for Quick Conversions
Manual conversion is valuable for building intuition, but for day-to-day work the Hex to Decimal converter on DevDecode handles it instantly — paste in any hex value, get the decimal result. It also supports batch conversion if you need to process a list.
Need the reverse? The Decimal to Hex tool works the same way in the opposite direction. For bit-level work, the Hex to Binary converter shows you the full binary representation, and the Hex Encoder/Decoder lets you encode arbitrary text into hex or decode hex strings back to readable text.
Summary
- Hexadecimal is base-16, using digits 0–9 and letters A–F
- Each hex digit maps to a nibble (4 bits); every two hex digits represent one byte
- The positional notation method multiplies each digit by 16 raised to its position, then sums the results
FF= 255,10= 16,2B= 43,1A3F= 6719- Python uses
int("FF", 16), JavaScript usesparseInt("FF", 16), Bash uses$((16#FF)) - Hex is everywhere in computing: memory addresses, CSS colors, IPv6, cryptographic output, file headers