Convert RGB colors to HSL for CSS, with hex, OKLCH and CMYK values alongside.
Enter a valid RGB value, like rgb(236, 72, 153)
Each channel is divided by 255, then the largest (max) and smallest (min) values decide the rest:
L = (max + min) ÷ 2
S = (max − min) ÷ (1 − |2L − 1|)
H = which channel is max, and how far the
other two are from each other, in degreesFor rgb(236, 72, 153), Tailwind's pink-500, that gives hsl(330, 81%, 60%).
| Color | RGB | HSL |
|---|---|---|
| White | rgb(255, 255, 255) | hsl(0, 0%, 100%) |
| Black | rgb(0, 0, 0) | hsl(0, 0%, 0%) |
| Red | rgb(255, 0, 0) | hsl(0, 100%, 50%) |
| Orange | rgb(255, 165, 0) | hsl(39, 100%, 50%) |
| Yellow | rgb(255, 255, 0) | hsl(60, 100%, 50%) |
| Green | rgb(0, 128, 0) | hsl(120, 100%, 25%) |
| Blue | rgb(0, 0, 255) | hsl(240, 100%, 50%) |
| Purple | rgb(128, 0, 128) | hsl(300, 100%, 25%) |
| Pink | rgb(255, 192, 203) | hsl(350, 100%, 88%) |
| Gray | rgb(128, 128, 128) | hsl(0, 0%, 50%) |
Type the three RGB numbers above, like 236, 72, 153 or rgb(236 72 153). The HSL value updates as you type. By hand, divide each channel by 255, then use the largest and smallest channel to find lightness, saturation and hue.
HSL is easier to adjust. Keep the hue and saturation, change only the lightness, and you get lighter and darker shades of the same color. That's useful for hover states and theme variables.
No, but values here are rounded to whole numbers. Converting back can be off by one in a channel, which you can't see.
HSL works everywhere and is easy to read. OKLCH keeps lightness consistent across hues, so a yellow and a blue at the same L look equally bright. Tailwind v4 uses OKLCH for its palette. The OKLCH value is shown under the result.