What the Colour Converter (HEX, RGB, HSL) does
The colour converter translates any colour between HEX, RGB, HSL and CMYK. Type a value in any of the common formats — #1d4ed8, rgb(29, 78, 216) or hsl(224, 76%, 48%) — or choose a colour with the picker, and all other formats appear instantly, ready to copy.
It also checks accessibility. For every colour the tool calculates the contrast ratio against white and against black text and rates it according to the Web Content Accessibility Guidelines (WCAG): AAA, AA, AA for large text only, or fail. That tells you at a glance whether text on a button, banner or background will be readable for everyone.
Everything runs in your browser, so it is fast and works offline once the page has loaded.
When to use it
Web design and CSS
Convert colours from a design file into the format your stylesheet uses, or adjust lightness in HSL.
Brand guidelines
Document a brand colour in HEX, RGB and CMYK so it can be used consistently on screen and in print.
Accessibility checks
Make sure text and buttons meet the WCAG contrast requirements before a website goes live.
Presentations and office documents
PowerPoint, Word and Canva often ask for RGB or HEX values — convert them in seconds.
Tips for the best results
- Use HSL to create lighter or darker variants of a colour: keep hue and saturation, change only the lightness.
- For body text, aim for a contrast ratio of at least 4.5:1 (AA); large headings need at least 3:1.
- CMYK values here are a mathematical conversion. For professional printing, ask your printer for values based on their colour profile.
- Screens display colours differently; check important colours on several devices.
- Three-digit HEX codes like #fa0 are a shorthand for #ffaa00 and are recognised too.
How the Colour Converter (HEX, RGB, HSL) works
HEX is simply RGB written in hexadecimal: each pair of digits is one channel from 00 to FF (0 to 255). HSL describes the same colour as hue (0–360°), saturation and lightness, which is more intuitive for creating variations. CMYK is derived from RGB using the standard formula K = 1 − max(R, G, B) and C, M, Y relative to the remaining brightness.
Contrast is calculated with the WCAG formula: the relative luminance of both colours is computed from their gamma-corrected RGB values, and the ratio (L1 + 0.05) ÷ (L2 + 0.05) ranges from 1:1 (no contrast) to 21:1 (black on white).
A ratio of 7:1 or more passes AAA, 4.5:1 passes AA for normal text and 3:1 passes AA for large text (about 24 px, or 19 px bold).