Hex to Decimal: Number Systems Explained Simply
By The IT Hustle Team
This article was generated with AI assistance and reviewed by our team for accuracy and quality. All technical information and examples have been verified.
You've seen hex color codes in CSS. You've seen 0xFF in low-level code. You've seen binary in networking documentation. These aren't different languages — they're different ways of writing the same numbers. Once that clicks, everything gets easier.
This guide explains the four number bases you'll encounter in computing: binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). No math degree required.
Why Computers Don't Use Decimal
Humans evolved using base 10 because we have 10 fingers. Computers use base 2 because transistors have two states: on and off. Every number your computer stores is ultimately a sequence of ones and zeros.
The number 255 is the same number in all four systems — it's just written as 11111111 in binary, 377 in octal, 255 in decimal, and FF in hex.
How Decimal Works (The Model for Everything)
In decimal, each digit position represents a power of 10:
The number 347:
3 × 10² = 3 × 100 = 300
4 × 10¹ = 4 × 10 = 40
7 × 10⁰ = 7 × 1 = 7
Total: 347
Every other number system works the same way — just with a different base instead of 10. Binary uses powers of 2. Hex uses powers of 16. Once you internalize this, converting between bases becomes mechanical.
Binary: The Foundation
Binary uses only 0 and 1. Each digit position is a power of 2:
Binary 1011 to decimal:
1 × 2³ = 1 × 8 = 8
0 × 2² = 0 × 4 = 0
1 × 2¹ = 1 × 2 = 2
1 × 2⁰ = 1 × 1 = 1
Total: 8 + 0 + 2 + 1 = 11
To convert decimal to binary, repeatedly divide by 2 and track the remainders:
Decimal 13 to binary:
13 ÷ 2 = 6 remainder 1 ← least significant bit
6 ÷ 2 = 3 remainder 0
3 ÷ 2 = 1 remainder 1
1 ÷ 2 = 0 remainder 1 ← most significant bit
Read remainders bottom-up: 1101
Key binary reference points every developer should know: 8 bits = 1 byte, max value 255 (11111111). 16 bits = max 65,535. 32 bits = max ~4.3 billion.
Hexadecimal: Binary's Readable Sibling
Binary is unwieldy. The number 255 in binary is eight digits: 11111111. Hex condenses it to two: FF. That's why hex is used everywhere binary is used — it's human-readable shorthand.
Hex uses 16 symbols: 0–9 and A–F (A=10, B=11, C=12, D=13, E=14, F=15).
Hex to decimal reference:
0–9 → 0–9 (same as decimal)
A → 10
B → 11
C → 12
D → 13
E → 14
F → 15
10 → 16
FF → 255
100 → 256
To convert hex to decimal, use powers of 16:
Hex 2A to decimal:
2 × 16¹ = 2 × 16 = 32
A × 16⁰ = 10 × 1 = 10
Total: 32 + 10 = 42
Where You'll Actually See Each Base
- CSS colors:
#FF5733(R=255, G=87, B=51) - Memory addresses:
0x7fff5fbff8e0 - Unicode code points:
U+1F600(😀) - SHA hashes and UUIDs
- MAC addresses:
00:1A:2B:3C:4D:5E
- Network subnet masks:
11111111.11111111.11111111.00000000 - Bitwise operations in code
- Flags and permission bitmasks
- Unix file permissions:
chmod 755(rwxr-xr-x) - Legacy C/C++ integer literals:
int x = 0777;
The Hex-Binary Shortcut
One hex digit always equals exactly four binary bits (a nibble). This makes converting between hex and binary trivial:
Hex to binary — convert each digit independently:
F = 15 = 1111
A = 10 = 1010
3 = 3 = 0011
FA3 in binary = 1111 1010 0011
This is why programmers use hex — it's direct shorthand for binary without the verbosity.
Converting in Code
You almost never convert by hand in practice. Every programming language has built-in functions:
JavaScript / TypeScript:
parseInt("FF", 16) // hex to decimal → 255
parseInt("1011", 2) // binary to decimal → 11
parseInt("377", 8) // octal to decimal → 255
(255).toString(16) // decimal to hex → "ff"
(255).toString(2) // decimal to binary → "11111111"
(255).toString(8) // decimal to octal → "377"
Python:
int("FF", 16) # hex to decimal → 255
int("1011", 2) # binary to decimal → 11
hex(255) # decimal to hex → "0xff"
bin(255) # decimal to binary → "0b11111111"
oct(255) # decimal to octal → "0o377"
CSS Colors: A Practical Hex Exercise
CSS hex colors are three pairs of hex digits — one pair each for red, green, and blue:
#FF5733 decoded:
FF = 255 → Red at full intensity
57 = 87 → Green at 34%
33 = 51 → Blue at 20%
The shorthand #F00 expands to #FF0000 — pure red. The 3-digit form works when both digits in each pair are identical.
Use our free Number Base Converter to convert between decimal, binary, octal, and hexadecimal instantly — paste any number in any base and see all the equivalents.
Quick Reference Table
The One Thing to Remember
Different bases are just different notations for the same underlying number. 255 = 0xFF = 0b11111111 = 0o377. They're identical values written in different scripts.
You don't need to master hand conversion. You do need to recognize hex when you see it, understand that CSS color #00FF88 is three bytes, and know that chmod 755 is octal. The rest is Google and parseInt().
We build free developer tools and write about AI, automation, and developer productivity. 100 tools, 40 articles, and an AI Prompt Engine — all built to help workers navigate the AI era. Published by Salty Rantz LLC.
Stay in the Loop
Be the first to know about new tools, blog posts, and updates. No spam.
Generate Your Own Anti-Hallucination Prompts
Our AI Prompt Engine uses proprietary technology to generate prompts with built-in verification and contradiction testing.
Try 3 Free Generations →