The Short Answer
There are 16,777,216 possible hex color codes in the standard 6-digit format. That's 256 shades of red ร 256 shades of green ร 256 shades of blue = 256ยณ = 16,777,216 unique combinations.
But the full answer is more interesting than that. Let's break it down.
Where 16.7 Million Comes From
A 6-digit hex code represents 3 bytes of data โ one byte each for red, green, and blue. One byte = 8 bits = 256 possible values (0-255).
| Channel | Hex Range | Decimal Range | Values |
|---|---|---|---|
| Red (RR) | 00 โ FF | 0 โ 255 | 256 |
| Green (GG) | 00 โ FF | 0 โ 255 | 256 |
| Blue (BB) | 00 โ FF | 0 โ 255 | 256 |
| Total | 16,777,216 | ||
256 ร 256 ร 256 = 224 = 16,777,216. This is also called "24-bit color" or "True Color."
What About 8-Digit Hex? 4.3 Billion More
With 8-digit hex codes (which add an alpha/transparency channel), you get one more byte:
256 ร 256 ร 256 ร 256 = 232 = 4,294,967,296 possible combinations
That's over 4 billion โ roughly half the population of Earth. But most of those are just different transparency levels of the same 16.7 million colors. So it's technically correct but a bit misleading to say "4 billion colors."
3-Digit Hex: Only 4,096 Colors
The shorthand 3-digit format (#RGB) has far fewer:
16 ร 16 ร 16 = 16ยณ = 4,096 colors
That's because each digit can only be 0-F (16 values) instead of two digits (256 values). 4,096 colors was the standard for "high color" displays in the early 2000s. Today it's mainly used for CSS brevity.
But How Many Colors Can Humans Actually See?
Here's where it gets philosophical. 16.7 million sounds like a lot, but can we actually tell them all apart?
The answer depends on who you ask and how you measure. Most studies put the number of distinguishable colors between:
- ~1 million โ conservative estimate for color differences under ideal conditions
- ~10 million โ more commonly cited figure for total distinguishable colors
- Up to 100 million โ claimed by some studies for people with tetrachromacy (4 cone types instead of 3)
So 16.7 million is probably more than most people can distinguish โ but not by as much as you might think. And there are definitely many real-world colors that 8-bit sRGB can't represent accurately.
Why 16.7 Million Isn't Enough
You might think 16.7 million colors is overkill. It's not. Here's why:
Smooth gradients need them
A gradient from dark blue to light blue across a 1920-pixel-wide screen needs ~1920 distinct shades to look smooth. With only 256 shades per channel, you can start to see visible banding in gradients โ especially in dark areas where our eyes are more sensitive to differences.
Color correction and editing
When you adjust brightness, contrast, or apply filters, you're stretching and compressing the available color values. Starting with only 256 levels per channel means you'll see posterization (banding) after just a couple of adjustments. That's why professional photo editing uses 16-bit per channel (65,536 levels) or even 32-bit floating point.
Gamut limitations
sRGB (what hex codes describe) only covers about 35% of visible colors. Wider gamuts like Display P3 or Rec. 2020 can show more vivid colors that hex/sRGB literally cannot represent. That's why modern devices are moving to P3 displays and CSS color(display-p3 ...) syntax.
Hex Colors in Practice
Even though 16.7 million sounds vast, designers and developers end up using a surprisingly small subset. A typical app or website might use only 50-200 distinct colors across its entire design system. The rest of the 16.7 million are unused โ but having them available means you always have the exact shade you need.
Want to explore the space? Our Color Picker lets you click anywhere on the full 16.7 million color spectrum and instantly get the hex code.
Fun Hex Color Facts
#000000(black) and#FFFFFF(white) are the most commonly used hex colors in CSS โ no surprise.- The most "average" color โ
#808080โ is literally middle gray in every channel. - In hexadecimal, A=10, B=11, C=12, D=13, E=14, F=15. That's why FF = 255 (15ร16+15).
- "Hex" comes from the Greek word "hexa" meaning six โ referring to the six characters in a standard hex color code.
Wrapping Up
So how many hex colors are there? 16,777,216 for standard 6-digit codes, plus a lot more if you count alpha. But the real answer is: enough for everyday web design, but not enough for everything. The future is wider color gamuts and higher bit depths โ but hex isn't going anywhere anytime soon.