Skip to content
ToolZone

RGB to HSL

Convert RGB color values into HSL format, representing color as hue, saturation, and lightness, useful for making intuitive color adjustments.

Runs in your browser. Nothing you enter or upload leaves your device.

HEX
#2563EB
RGB
rgb(37, 99, 235)
HSL
hsl(221, 83%, 53%)
CMYK
cmyk(84%, 58%, 0%, 8%)

Contrast (WCAG)

Aa
On white: 5.17:1
✓ AA✗ AAA✓ AA large
Aa
On black: 4.06:1
✗ AA✗ AAA✓ AA large

Tints and shades

Color harmonies

Complementary
Analogous
Triadic

Click any swatch to select it.

Keyboard shortcuts

Run the main action
⌘ / Ctrl + Enter
Copy the result
⌘ / Ctrl + Shift + Enter
Download the result
⌘ / Ctrl + S
Paste a file or image into file tools
⌘ / Ctrl + V
Search all tools
⌘ / Ctrl + K
Show these shortcuts
?

You can also drop files anywhere on the page.

About the RGB to HSL

HSL describes color in terms people find intuitive: the hue on a color wheel, how vivid it is, and how light or dark. Type an rgb() value, a HEX code or an hsl() value and this tool shows all the formats together, with a preview, contrast checks and color harmonies.

How it works

The red, green, and blue values are divided by 255 so they fall between 0 and 1. Lightness is the average of the largest and smallest of the three. If all three are equal, the color is a gray with 0% saturation and a hue of 0.

Otherwise, saturation is the spread between the largest and smallest channel divided by a factor that depends on whether lightness is above or below 50%. Hue is found from which channel is largest and the relative size of the other two, expressed as an angle from 0 to 360 degrees, where 0 is red, 120 is green, and 240 is blue. The tool rounds hue to whole degrees and saturation and lightness to whole percentages.

How to use

  1. 1

    Type an rgb() value or HEX code into the Color field, or click the swatch to pick a color.

  2. 2

    Read the HSL row for hue, saturation, and lightness.

  3. 3

    Click the copy icon to copy the hsl() value.

Worked examples

Emerald green

Getting HSL so you can make a darker hover color.

Input
rgb(16, 185, 129) / #10b981
Result
hsl(160, 84%, 39%)

Green is the largest channel, so the hue lands in the green-cyan part of the wheel at 160 degrees.

Bright blue

Converting a primary button color.

Input
rgb(37, 99, 235) / #2563eb
Result
hsl(221, 83%, 53%)

Mid gray

Seeing how a neutral color looks in HSL.

Input
rgb(128, 128, 128) / #808080
Result
hsl(0, 0%, 50%)

Equal channels mean no saturation, so hue is reported as 0.

Limitations
HSL values are rounded to whole numbers. Alpha transparency is ignored.
Assumptions
Colors are in the sRGB space used by CSS. RGB channels are whole numbers from 0 to 255.
Privacy
Conversions are done in your browser, and nothing you enter is sent to a server or stored.

Frequently asked questions

Why would I prefer HSL over RGB for adjusting a color?+

In HSL you can change lightness or saturation with one number, while in RGB you would need to recalculate all three channels to get the same effect.

What does the hue value represent?+

Hue is an angle from 0 to 360 degrees on the color wheel. 0 is red, 120 is green, and 240 is blue.

Why is the hue 0 for gray, black, and white?+

When red, green, and blue are equal, the color has no saturation, so hue has no effect and the tool reports it as 0.

How do I enter RGB values directly?+

Open the color picker by clicking the swatch. Many browsers let you switch the picker to RGB and type the numbers. You can also convert RGB to HEX first and paste the HEX code.

Can I use the hsl() output directly in CSS?+

Yes. The output is written as hsl(h, s%, l%), which every modern browser accepts.

Related tools