HEX, RGB, and HSL explained
Every color on a screen can be expressed in multiple formats. HEX, RGB, and HSL all describe the same colors — they just use different notation. Knowing all three makes you more effective in CSS, design tools, and anywhere color values appear.
| Format | Example | Best for |
|---|---|---|
| HEX | #FF5733 | Compact notation, copy-pasting color codes |
| RGB | rgb(255, 87, 51) | Combining with opacity (rgba), programmatic manipulation |
| HSL | hsl(11, 100%, 60%) | Creating color scales, reasoning about shades |
How to read HSL
HSL stands for Hue, Saturation, Lightness. It is more intuitive than RGB for color design because each property controls something visually obvious:
- Hue (0–360°) — the color itself. 0° = red, 120° = green, 240° = blue.
- Saturation (0–100%) — color intensity. 0% is grey, 100% is full color.
- Lightness (0–100%) — brightness. 0% is black, 50% is normal, 100% is white.
This makes HSL excellent for creating tints and shades: keep H and S constant and vary L to get lighter or darker versions of the same color.
Common web colors
| Color | HEX | RGB | HSL |
|---|---|---|---|
| Red | #FF0000 | 255, 0, 0 | 0°, 100%, 50% |
| Green | #00FF00 | 0, 255, 0 | 120°, 100%, 50% |
| Blue | #0000FF | 0, 0, 255 | 240°, 100%, 50% |
| White | #FFFFFF | 255, 255, 255 | 0°, 0%, 100% |
| Black | #000000 | 0, 0, 0 | 0°, 0%, 0% |
| Coral | #FF5733 | 255, 87, 51 | 11°, 100%, 60% |
| Teal | #008080 | 0, 128, 128 | 180°, 100%, 25% |