Understanding Hex Colors: From #000000 to #FFFFFF
A hex color code is a base-16 way of writing three numbers: how much red, how much green, and how much blue a color contains. #000000 is all three at zero, which is black. #FFFFFF is all three at maximum, which is white. Every other color on the web is a point somewhere between those two, and once you can read the six digits you can predict roughly what a code will look like before you paste it anywhere.
The anatomy of #RRGGBB
Six digits, three pairs, one pair per channel. Each pair runs from 00 to FF, which in ordinary decimal is 0 to 255 — 256 levels per channel, and 256 × 256 × 256 = 16,777,216 possible colors. The # is punctuation that tells CSS "a hex color follows"; it is not part of the value.
| Position | Channel | Range | Meaning |
|---|---|---|---|
#RRGGBB | Red | 00–FF | 0–255 |
#RRGGBB | Green | 00–FF | 0–255 |
#RRGGBB | Blue | 00–FF | 0–255 |
Case is irrelevant: #ff6600 and #FF6600 are the same color, and every tool on this site accepts either.
Reading a hex code without a converter
Take #2D6A4F. Split it into 2D, 6A, 4F — red, green, blue. To turn a pair into decimal, multiply the first digit by 16 and add the second, remembering that A through F stand for 10 through 15:
2D → (2 × 16) + 13 = 45 red
6A → (6 × 16) + 10 = 106 green
4F → (4 × 16) + 15 = 79 blue
So #2D6A4F is rgb(45, 106, 79). Green is the largest of the three, so it is a green; the largest channel is only 106 out of 255, so it is a dark one. That is the whole trick — compare the pairs to find the hue, look at the biggest pair to judge the lightness, and look at how far apart the pairs are to judge how saturated it is. Three roughly equal pairs means a gray. If you want the arithmetic done for you, the hex to RGB converter shows each step.
Landmarks worth memorising
The digit order is 0 1 2 3 4 5 6 7 8 9 A B C D E F. A handful of pairs come up constantly:
00= 0 (none of that channel)40= 64 (about a quarter)80= 128 (about half)C0= 192 (about three quarters)FF= 255 (full)
Shorthand: when #RGB works
Three-digit hex is an abbreviation where each digit is doubled: #ABC means #AABBCC, and #F60 means #FF6600. It only works when both digits of every pair are identical, so it can express 4,096 colors out of the 16.7 million available. #2D6A4F has no shorthand form, and neither will most colors you actually pick — shorthand is a convenience for round numbers, not a general notation.
Eight digits: #RRGGBBAA
A fourth pair adds alpha — opacity. FF is fully opaque, 00 fully transparent, 80 approximately 50%. So #2563EB80 is a half-transparent blue, and the four-digit shorthand #0008 is black at about 53% opacity. Every current browser supports both, which means you rarely need rgba() any more.
A worked edit: making a hex lighter by hand
Lightening a color — producing a tint — means moving every channel toward 255 by the same proportion:
new_channel = old_channel + (255 − old_channel) × factor
Take #2D6A4F — rgb(45, 106, 79) — and lighten it by 20%, so factor is 0.2:
red: 45 + (255 − 45) × 0.2 = 87 → 57
green: 106 + (255 − 106) × 0.2 = 136 → 88
blue: 79 + (255 − 79) × 0.2 = 114 → 72
Reassemble the three pairs and you have #578872. Darkening is the mirror image — multiply each channel by (1 − factor) instead. You can check either result in seconds with the lighten color tool or the darken color tool, both of which run the same arithmetic on a slider, or generate the whole ramp at once in the tint and shade generator.
When to stop thinking in hex
Hex is an excellent storage and transport format: compact, unambiguous, copy-pasteable, understood by every tool. It is a poor thinking format. "Same color but 10% lighter" is invisible in hex — you have to recompute three channels — while in HSL it is one number changing. The same goes for "same lightness, different hue", which is how harmonies on a color wheel work.
The practical workflow is to move between them: pick and store in hex, reason in HSL. The hex to HSL converter goes one way and HSL to hex comes back, and the color scale generator lets you drag along the lightness, hue, and chroma axes of any hex without converting anything by hand.
The short version
- Six digits, three channels,
00–FFeach, meaning 0–255. - Convert a pair with (first × 16) + second, where A–F are 10–15.
- Biggest pair tells you the hue; its size tells you the lightness; the spread between pairs tells you the saturation.
#ABCis shorthand for#AABBCC, and only some colors have one.- A fourth pair is alpha, and hex always means sRGB.
From here, the natural next step is building something with a code you like: generate its tints and shades, or find the colors that go with it.