#FFFFFF, #1A1A2E, #FFD700 — six characters after a hash, showing up in nearly every frontend codebase and design annotation. Plenty of people use them daily without knowing what each position means. The logic is surprisingly simple, and once it clicks, reading color codes starts to feel like reading a phone number: you can just see it.
In this article
1. Hexadecimal Counting Basics
We count in base ten because we have ten fingers. Computers take a different path — their circuits have two states, on and off — so hexadecimal was invented as a compact way to write long binary strings: 4 binary digits fit exactly into 1 hex digit, and 2 hex digits express one full byte (8 binary digits, values 0–255). Color codes chose hexadecimal precisely because it expresses three bytes compactly.
The hexadecimal alphabet has just 16 characters: 0 through 9 mean zero to nine as usual, and the letters A through F stand in for 10 through 15. Here is the mapping:
| Decimal | 0 | 5 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
|---|---|---|---|---|---|---|---|---|---|
| Hexadecimal | 0 | 5 | 9 | A | B | C | D | E | F |
The rule for a two-digit hex number: high digit × 16 + low digit. For example FF = 15 × 16 + 15 = 255, exactly the maximum of one byte. That is also why letters appear in HEX colors — they are not "code", just ordinary digits standing for ten through fifteen.
2. What Each Pair in #RRGGBB Means
The hash is only a marker, a way of saying "a color value follows" — it carries no meaning itself. The real content is the six characters after it: three pairs, one each for the brightness of the red, green, and blue channels.
From 00 (no red light at all) to FF (red at full strength, 255).
Also 00 to FF. Many "natural looking" colors on screen rely on the green channel doing the blending work.
Also 00 to FF. Stack all three channels together and you get the color of light that pixel emits.
Test it with #FF0000: the red channel is FF (maxed), green and blue are both 00 (off), so it is pure red. Likewise #00FF00 is pure green, #0000FF pure blue, #FFFFFF with all three channels fully on is white, and #000000 with everything off is black.
3. 3-Digit Shorthand and 8-Digit Alpha
You have surely seen #FFF. The rule: the browser automatically duplicates each digit, so #FFF expands to #FFFFFF, and #F60 expands to #FF6600.
Keep in mind the shorthand only covers some colors: it works only when both digits within each pair are identical. In #FF6B35 the pairs 6B and 35 fail that test, so it has no 3-digit form. That is why some colors are always written with six digits.
8-digit HEX: alpha inside the color value
Append two more digits after the six, and you get 8-digit HEX, where the last pair is transparency (alpha). 00 is fully transparent, FF fully opaque, and 80 lands around half. The values you will reach for most often:
| Last pair | Opacity | Typical use |
|---|---|---|
CC | 80% | card overlays, image scrims |
99 | 60% | secondary text, disabled states |
80 | 50% | translucent backgrounds |
40 | 25% | hover highlights, dividers |
1A | 10% | shadows, subtle tints |
/* Orange at about 80% opacity */
background: #FF6B35CC;
/* Equivalent */
background: rgba(255, 107, 53, 0.8);
4. How to Eyeball a Color from Its HEX Code
Once the channels make sense, an unfamiliar color code stops being opaque. You can estimate what it looks like with a quick scan of how the three pairs compare:
- Overall brightness first: all pairs large (near FF) means a light color; all pairs small (near 00) means a dark one.
- Then the leader: whichever channel clearly dominates pulls the hue that way. Big red leans red; big red plus big green leans yellow.
- All three close together: that is a gray, and the closer they are, the more neutral it looks.
Two quick examples. #336699: blue clearly leads on a dark body — a calm, deep blue that works well for body links. #669933: red and green both mid-range with green ahead and almost no blue — an olive-leaning yellow-green. #333: three equal, small channels — a near-black dark gray, one of the most common body-text colors in UI.
#RRGGBB is, in the end, just "three numbers from 0 to 255" written in hexadecimal. Once that lands, HEX stops being a mysterious code and becomes a readable language — and the next time you see #FFD700, you will know instantly that it is gold: red and green maxed, blue absent.