Colours turn up in many formats. A brand guide gives you HEX, a design tool exports HSL, a modern CSS framework expects OKLCH, and the print shop asks for CMYK. Converting by hand is slow and easy to get wrong. Paste the colour once here and every format is ready to copy.
Which format to use
- HEX (
#2563eb) is compact and understood everywhere. Good for brand colours and quick sharing. - RGB lists red, green and blue from 0 to 255. Handy when you need transparency:
rgb(37 99 235 / 0.4). - HSL uses hue, saturation and lightness. Easy to tweak by hand, though equal lightness values don’t always look equally light.
- OKLCH fixes that. A yellow and a blue at the same OKLCH lightness really do look equally bright, which is why Tailwind CSS v4 and many design systems now define their palettes in it.
- CMYK is for print. Screens can show colours ink can’t reproduce, and the other way round.
Contrast at a glance
Below the formats you’ll see how the colour scores against white and black, and which of the two makes more readable text on top of it. For example, a mid-blue like #3b82f6 scores about 3.7:1 with white text, enough for large headings but short of the 4.5:1 needed for body text. Use the contrast checker for a full WCAG report.
Sharing a colour
You can link straight to a colour by adding ?c= and a value to the page address, for example ?c=ff6600.
How to use the Color Converter
- Paste a colour into the field, or click the swatch next to it to pick one.
- Use any format:
#3b82f6,rgb(59 130 246),hsl(217 91% 60%),oklch(62% 0.19 260)or a colour name. - Drag Opacity to add transparency.
- Click Copy next to the format you want.
Features
- Reads HEX (3, 4, 6 and 8 digits), rgb(), hsl(), hwb(), oklch(), oklab() and all 148 CSS colour names.
- Outputs HEX, RGB, HSL, HWB, OKLCH, CMYK and a CSS custom property.
- Out-of-range OKLCH colours are mapped into sRGB by reducing chroma, keeping lightness and hue.
- Contrast against white and black, and a suggested text colour.
- Modern space-separated CSS syntax, with alpha after a slash.
Frequently asked questions
How do I convert HEX to RGB?
Split the six digits into three pairs and read each pair as a base-16 number. #3b82f6 becomes 3b = 59, 82 = 130 and f6 = 246, so rgb(59 130 246). The converter does it instantly for any colour.
What is OKLCH and why use it?
OKLCH describes a colour by lightness, chroma (colourfulness) and hue, in a space designed around human vision. Changing only the lightness gives shades that look evenly spaced, which makes it popular for design systems and palettes.
Is the CMYK value accurate for printing?
It is a straight mathematical conversion with no colour profile. Printers use profiles that depend on paper and ink, so treat it as a starting point and ask your print shop for exact values.
What is the difference between rgb() and rgba()?
None in modern CSS. rgb() accepts an alpha value after a slash, like rgb(59 130 246 / 0.5). rgba() still works as an older alias.
Written by Dewan Razib