One colour, every format
| Format | Example | Good for |
|---|---|---|
| HEX | #3b82f6 | Design tools, compact CSS |
| RGB | rgb(59 130 246) | Mixing channels in code |
| HSL | hsl(217 91% 60%) | Quick hand tweaks of hue and saturation |
| HWB | hwb(217 23% 4%) | Tints and shades: add white or black |
| OKLCH | oklch(62.3% 0.188 259.8) | Palettes, design tokens, consistent lightness |
| OKLAB | oklab(62.3% -0.033 -0.185) | Smooth gradients and colour mixing |
Modern CSS uses spaces between values and a slash before alpha: rgb(59 130 246 / 50%). The tool also gives the older comma form for codebases that need it.
Mistakes it fixes
- Look-alike letters in hex, like
Ofor0orlfor1. - Wrong number of hex digits; 5 or 7 usually means one was lost or doubled when copying.
- A missing
#, or a missing closing bracket. - Values out of range, like
rgb(300 0 0)or 120% lightness, which are clamped and flagged. - Commas mixed with a slash for alpha, which browsers reject.
- Misspelled colour names, with the closest real one suggested.
- Colours outside sRGB, from wide-gamut OKLCH values, which are mapped to the nearest colour most screens can show.
Building a scale with OKLCH
The lightness scale under the converter keeps the same hue and chroma and steps the OKLCH lightness evenly, the way palettes like Tailwind’s are built. Click a step to load it. Because OKLCH lightness matches what we see, a step that passes contrast in one hue will usually pass in another at the same lightness.
:root {
--brand-300: oklch(80% 0.1 260);
--brand-500: oklch(62% 0.19 260);
--brand-700: oklch(45% 0.17 260);
}Contrast at a glance
Each colour shows its WCAG contrast ratio against white and black, so you can see straight away whether it works for text. For a full check against your own background, with AA and AAA results and the nearest passing colour, open it in the contrast checker.
Questions people ask
How do I convert HEX to RGB?
#3b82f6 is 3b = 59, 82 = 130, f6 = 246, so rgb(59 130 246). A 3-digit hex like #f80 doubles each digit: #ff8800.What is OKLCH and why use it?
oklch() in CSS.Why does HSL lightness look different for different colours?
hsl(60 100% 50%) (yellow) looks far brighter than hsl(240 100% 50%) (blue), even though both say 50% lightness. OKLCH fixes this.How do I add transparency to a hex colour?
#3b82f680 is about 50% opaque (80 hex = 128 of 255). In functional syntax, use a slash: rgb(59 130 246 / 50%). The old rgba() and hsla() forms still work too.Can I paste colours from code?
rgb(), rgba(), hsl(), hwb(), oklch(), oklab() or CSS colour name. Hex without a #, a missing bracket, or values out of range are marked and fixed for you.