Colour converter and contrast checker
Convert any colour between the formats designers and developers use: HEX, RGB, HSL, HWB, the modern OKLCH used in CSS, and CMYK for print. Type a code in any CSS syntax or pick a colour, then copy the format you need. The contrast checker shows the WCAG ratio of the colour as text on white, on black or on a background you choose, with clear AA and AAA pass or fail labels, so your text stays readable for everyone.
- hex
#2ee58f - rgb
rgb(46 229 143) - hsl
hsl(151.8 77.9% 53.9%) - hwb
hwb(152 18% 10%) - oklch
oklch(81.53% 0.1858 156.41) - cmyk
cmyk(80% 0% 38% 10%)
Text contrast (WCAG)
- On white1.65:1AA failAAA fail
- On black12.72:1AA passAAA pass
How to use the Colour Converter & Contrast Checker
- 1
Enter a colour
Type a code such as #2ee58f, rgb(46 229 143) or hsl(152 77% 54%), or use the colour picker.
- 2
Copy a format
Every format updates instantly; copy the one you need.
- 3
Check contrast
See the contrast ratio on white and black, and add your own background colour.
- 4
Adjust if needed
If a pairing fails AA, darken or lighten the colour until it passes.
How the conversions and contrast work
HSL and HWB rearrange the same sRGB values by hue, saturation and lightness. OKLCH uses the OKLab perceptual model from CSS Color 4, so equal lightness values look equally bright. CMYK here is a simple device-independent estimate; printers use colour profiles.
Contrast follows WCAG 2.x: each colour's relative luminance is computed from linearised sRGB, and the ratio is (lighter + 0.05) ÷ (darker + 0.05). AA needs 4.5:1 for normal text and 3:1 for large text; AAA needs 7:1.
- contrast = (L1 + 0.05) ÷ (L2 + 0.05)
- #ff0000 = rgb(255 0 0) = hsl(0 100% 50%) = oklch(62.8% 0.2577 29.23)
When to use it
- Convert brand colours from a style guide into CSS.
- Check that button and text colours meet accessibility rules.
- Move a palette to OKLCH for more even lightness.
Limits
- CMYK values are approximate; printed colour depends on the printer and paper profile.
- Contrast for semi-transparent colours ignores what is behind them.
Privacy
All conversions run in your browser.
Frequently asked questions
What contrast ratio do I need?
WCAG AA requires 4.5:1 for normal text and 3:1 for large text (about 24 px, or 19 px bold). AAA requires 7:1 and 4.5:1.
What is OKLCH?
A colour format in CSS that describes lightness, chroma and hue as people perceive them, which makes consistent palettes easier.
Why does my CMYK not match my printer?
Printers use colour profiles and real inks. The values here are a simple conversion and a starting point only.
Which colour formats can I type?
HEX (3, 4, 6 or 8 digits), rgb(), hsl(), hwb(), oklch() in modern or comma syntax, and common colour names.
Is #fff the same as #ffffff?
Yes. Three-digit hex doubles each digit, so #fff is #ffffff.
Does it work offline?
Once the page has loaded, conversions need no connection.
Related tools
People also use
- JWT Generator & SignerCreate and sign JSON Web Tokens with HMAC, RSA or ECDSA keys, entirely in your browser.
- Base64 Encoder & DecoderEncode and decode Base64 and Base64url, text or files.
- URL Encoder & DecoderPercent-encode or decode URLs and see their query parameters.
- CSV to JSON ConverterConvert CSV ⇄ JSON with correct quoting, types and nested data.
Last updated November 20, 2026 · How we build and test our tools