RGB to HSL Converter
RGB in, HSL out — with the working shown.
To convert RGB to HSL, normalise the input, find max, min and delta, compute the components, then check the gamut. For example, rgb(47 129 247) in RGB is hsl(215.4 92.6% 57.6%) in HSL.
This is a free RGB to HSL converter. Type or paste any red, green and blue channel values into the field above and the HSL value updates as you type, along with every other notation the web understands. HSL is a cylindrical remapping of RGB into hue (0–360°), saturation (0–100%) and lightness (0–100%).
Conversions run entirely in your browser using the same color engine as the rest of the site: values round-trip through linear sRGB and CIE XYZ rather than through an approximation, so what you copy is accurate to the last digit the format can carry.
How to convert RGB to HSL
- Normalise the input. Read the RGB value and scale each component into the 0–1 range the maths expects.
- Find max, min and delta. Take the largest and smallest of the three channels. Their difference drives saturation; which one is largest determines the hue sector.
- Compute the components. Lightness is (max + min) / 2, saturation is delta scaled by how close lightness is to the middle, and hue comes from the dominant channel.
- Check the gamut. Clamp anything that falls outside what an sRGB display can show, so the value you copy is the value you get.
Worked example: rgb(47 129 247) converts to hsl(215.4 92.6% 57.6%). That color is Dodger Blue, and the tool above shows each intermediate step for whatever value you enter.
Common RGB to HSL values
The twenty colors people look up most often, converted from RGB to HSL. Every row is computed by the same engine as the tool above.
| 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%) |
| Lime | rgb(0 255 0) | hsl(120 100% 50%) |
| Blue | rgb(0 0 255) | hsl(240 100% 50%) |
| Yellow | rgb(255 255 0) | hsl(60 100% 50%) |
| Cyan | rgb(0 255 255) | hsl(180 100% 50%) |
| Magenta | rgb(255 0 255) | hsl(300 100% 50%) |
| Silver | rgb(192 192 192) | hsl(0 0% 75.3%) |
| Gray | rgb(128 128 128) | hsl(0 0% 50.2%) |
| Maroon | rgb(128 0 0) | hsl(0 100% 25.1%) |
| Olive | rgb(128 128 0) | hsl(60 100% 25.1%) |
| Green | rgb(0 128 0) | hsl(120 100% 25.1%) |
| Purple | rgb(128 0 128) | hsl(300 100% 25.1%) |
| Teal | rgb(0 128 128) | hsl(180 100% 25.1%) |
| Navy | rgb(0 0 128) | hsl(240 100% 25.1%) |
| Orange | rgb(255 165 0) | hsl(38.8 100% 50%) |
| Pink | rgb(255 192 203) | hsl(349.5 100% 87.6%) |
| Gold | rgb(255 215 0) | hsl(50.6 100% 50%) |
| Crimson | rgb(220 20 60) | hsl(348 83.3% 47.1%) |
RGB and HSL, briefly
RGB is three channels from 0 to 255 describing how hard the display drives its red, green and blue subpixels. Valid range: 0–255 per channel.
HSL is a cylindrical remapping of RGB into hue (0–360°), saturation (0–100%) and lightness (0–100%). Valid range: H 0–360°, S and L 0–100%.
Frequently asked questions
How do you convert RGB to HSL?
1. Read the RGB value and scale each component into the 0–1 range the maths expects. 2. Take the largest and smallest of the three channels. Their difference drives saturation; which one is largest determines the hue sector. 3. Lightness is (max + min) / 2, saturation is delta scaled by how close lightness is to the middle, and hue comes from the dominant channel. 4. Clamp anything that falls outside what an sRGB display can show, so the value you copy is the value you get. The converter on this page does all of it as you type, and shows the working underneath.
What is rgb(255 0 0) in HSL?
Pure red, rgb(255 0 0), is hsl(0 100% 50%) in HSL. There is a table of twenty common colors converted to HSL further up this page.
What is rgb(47 129 247) in HSL?
rgb(47 129 247) converts to hsl(215.4 92.6% 57.6%). It is a dodger blue, and you can paste any other value into the field at the top of the page to convert it.
Is RGB to HSL conversion lossless?
Within sRGB, yes — converting to HSL and back returns the value you started with. The only rounding happens when a component is written out to a fixed number of decimal places.
Can I use HSL directly in CSS?
Yes. hsl(215.4 92.6% 57.6%) is valid CSS and works in every current browser.
Does this RGB to HSL converter support transparency?
Alpha is preserved wherever the target notation can carry it — eight-digit hex, rgb() / a, hsl() / a and the modern CSS spaces all round-trip an alpha channel. CMYK has no alpha, so it is dropped there.
Is my color data sent anywhere?
No. Every conversion on this site runs in your browser with no network request, no account and no analytics. You can disconnect and it keeps working.