Get online today — Domain + Hosting at discounted prices View Combo Offers ›

HEX / RGB / HSL Color Converter

Convert HEX, RGB and HSL, with contrast ratios and a palette.

Enter a colour in any common notation — #3b82f6, rgb(59 130 246), hsl(217 91% 60%) or a CSS name like steelblue — and get every other format back.

You also get WCAG contrast ratios against black and white, so you can tell at a glance which text colour is legible on it, plus a set of tints, shades and harmonies derived from the same hue.

How it works

HEX and RGB are the same thing written differently. Both describe a colour as three channel intensities from 0 to 255; hex just writes each byte as two hexadecimal digits. #3b82f6 and rgb(59, 130, 246) are identical values, and converting between them is pure notation with nothing lost in either direction.

HSL rearranges the same colour into hue, saturation and lightness, which is far easier to reason about. Hue is an angle on the colour wheel, so rotating it by 180° gives the complement. Saturation controls how much colour is present, lightness how much white or black is mixed in. This is why design systems are usually authored in HSL: a consistent palette is a matter of fixing the hue and stepping the lightness, which is almost impossible to do by eye in hex.

CMYK is included for print work, but be aware that the conversion shown here is the naive arithmetic one. Real print output depends on the paper, the inks and an ICC profile, so treat these numbers as a starting point for a designer rather than a specification for a printer.

The contrast figures follow WCAG 2.1. Each colour's relative luminance is computed by linearising the channels — undoing the sRGB gamma curve — and weighting them 0.2126 red, 0.7152 green, 0.0722 blue, which reflects how much each contributes to perceived brightness. The ratio between two colours then runs from 1:1 to 21:1. Normal body text needs 4.5:1 to pass AA and 7:1 for AAA; large text (18pt, or 14pt bold) needs only 3:1. The green channel dominating that formula is why a mid-yellow reads as bright and a saturated blue of the same hex "weight" reads as dark.

Frequently asked questions

What does the fourth pair of hex digits mean?

It is the alpha channel — opacity — in eight-digit hex like #3b82f680. 00 is fully transparent and ff fully opaque. It is supported in every current browser, though older tooling sometimes drops it silently.

Why convert to HSL at all?

Because it makes deliberate colour relationships easy. Holding hue and saturation constant and varying only lightness produces a coherent scale of tints and shades; rotating the hue by fixed amounts produces complementary or triadic partners. Both are guesswork in hex.

Are the CMYK values print-accurate?

No. This is the standard arithmetic conversion with no colour management, and real presses depend on ink, stock and an ICC profile. Use these as an approximation, and let your printer supply the definitive values for anything that matters.

What contrast ratio do I need?

WCAG AA requires 4.5:1 for normal text and 3:1 for large text, meaning 18pt or 14pt bold. AAA raises that to 7:1 and 4.5:1. User interface components and meaningful graphics need 3:1 against what surrounds them.

Why does a bright yellow fail contrast against white?

Because luminance is weighted by how the eye responds, and green — which dominates yellow — carries about 72% of perceived brightness. Yellow is therefore nearly as luminous as white, so the ratio between them is small however different they look.

Can I use CSS colour names in production?

Yes, all 148 are standard and render identically across browsers. They are convenient in prototypes, but a design system usually wants explicit values or custom properties, since a name gives no indication of its relationship to the rest of the palette.

Related tools

Need hosting that just works?

Free SSL, daily backups and 24×7 support on every Loudhost plan.

View Hosting Plans