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

ChannelHex RangeDecimal RangeValues
Red (RR)00 โ€“ FF0 โ€“ 255256
Green (GG)00 โ€“ FF0 โ€“ 255256
Blue (BB)00 โ€“ FF0 โ€“ 255256
Total16,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.

๐Ÿค“ Nerd fact: Named web colors? There are only 140 of them defined in the CSS color specification. That's 140 out of 16.7 million โ€” 0.0008%. The vast majority of hex colors have no name at all.

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:

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

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.