RGB to HSL Converter

Convert RGB colors to HSL for CSS, with hex, OKLCH and CMYK values alongside.

Enter a valid RGB value, like rgb(236, 72, 153)

  • HSL
  • Hex
  • OKLCH
  • CMYK

How RGB to HSL conversion works

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 degrees

For rgb(236, 72, 153), Tailwind's pink-500, that gives hsl(330, 81%, 60%).

Common colors in HSL

ColorRGBHSL
Whitergb(255, 255, 255)hsl(0, 0%, 100%)
Blackrgb(0, 0, 0)hsl(0, 0%, 0%)
Redrgb(255, 0, 0)hsl(0, 100%, 50%)
Orangergb(255, 165, 0)hsl(39, 100%, 50%)
Yellowrgb(255, 255, 0)hsl(60, 100%, 50%)
Greenrgb(0, 128, 0)hsl(120, 100%, 25%)
Bluergb(0, 0, 255)hsl(240, 100%, 50%)
Purplergb(128, 0, 128)hsl(300, 100%, 25%)
Pinkrgb(255, 192, 203)hsl(350, 100%, 88%)
Grayrgb(128, 128, 128)hsl(0, 0%, 50%)

Questions

How do I convert RGB to HSL?

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.

Why convert RGB to HSL?

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.

Does converting to HSL change the color?

No, but values here are rounded to whole numbers. Converting back can be off by one in a channel, which you can't see.

Should I use HSL or OKLCH?

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.

More free tools

Landings
Landing Page Examples
Copyright © 2026. All rights reserved.