Instant RGB to HSL Conversion
Get hue in degrees plus saturation and lightness in percent the moment you change a color. The large swatch shows the exact color, so you can check the result by eye as well as by number.
Convert RGB or HEX to HSL instantly. Adjust sliders, pick colors, paste values or batch convert. Free and no signup.
hsl(11, 100%, 60%)
hsl(11 100% 60%)
11, 100%, 60%
rgb(255, 87, 51)
#FF5733
hsb(11, 80%, 100%)
Paste one color per line (up to 500). Use RGB numbers, rgb(...) or HEX codes.
| Color | Input | HSL | HEX |
|---|---|---|---|
| Your converted colors will appear here. | |||
Move the sliders, use the color picker or paste an RGB or HEX value.
Hue, saturation and lightness update live, together with HEX and HSB.
Copy the hsl() value for CSS, or pick a ready-made shade from the strip.
Want to turn an RGB color into HSL for your stylesheet, design system or color palette? Our free RGB to HSL converter changes red, green and blue values into hue, saturation and lightness in real time, right in your browser. There is nothing to install, no signup and no file upload. Move the R, G and B sliders, use the color picker, type exact numbers, or paste a value such as rgb(255, 87, 51) or a HEX code like #FF5733, and the HSL result appears instantly together with the matching HEX, RGB and HSB values. Front-end developers who want an RGB to HSL CSS value, designers building shades and tints, students learning how color models work and anyone searching for a quick RGB to HSL calculator will find this tool fast and easy to use. Need to convert many colors? The built-in bulk RGB to HSL converter handles up to 500 colors at once and lets you copy the results as a list or CSV.
Get hue in degrees plus saturation and lightness in percent the moment you change a color. The large swatch shows the exact color, so you can check the result by eye as well as by number.
Copy ready-to-paste hsl() strings in both the classic comma syntax and the modern space syntax, so the value works in any stylesheet, framework or design token file.
Not starting from RGB? Paste a three-digit or six-digit HEX code and get the HSL value straight away. The tool accepts HEX with or without the hash sign.
Design apps often use HSB (also called HSV) instead of HSL. Every conversion also shows the HSB value, so you can compare both models without opening a second tool.
See nine lighter and darker versions of your color with the same hue and saturation. Click any shade to load it into the converter and copy its HSL, RGB or HEX value.
Paste a long list of colors, one per line, and convert up to 500 at once. Invalid lines are flagged clearly, and all valid results can be copied as an HSL list or as CSV for spreadsheets. Everything runs privately in your browser.
You do not need a design program or a calculator to turn RGB into HSL. Follow these simple steps to convert RGB to HSL with our free online tool.
Because the converter updates as you type, you can experiment freely. Drag the green slider and watch the hue move, or pick a gray and see saturation drop to zero.
The RGB to HSL formula looks long, but it follows five clear steps. First divide each of R, G and B by 255 so they become numbers between 0 and 1. Then find the largest value (Cmax), the smallest value (Cmin) and the difference between them (Δ). Finally calculate lightness, saturation and hue from those three numbers.
| Step | Formula | Notes |
|---|---|---|
| 1. Normalize | R′ = R ÷ 255, G′ = G ÷ 255, B′ = B ÷ 255 | Each value now sits between 0 and 1 |
| 2. Range | Cmax = max(R′, G′, B′), Cmin = min(R′, G′, B′), Δ = Cmax − Cmin | Δ tells you how colorful the color is |
| 3. Lightness | L = (Cmax + Cmin) ÷ 2 | Multiply by 100 to get a percentage |
| 4. Saturation | S = 0 if Δ = 0, otherwise S = Δ ÷ (1 − |2L − 1|) | Grays have no saturation |
| 5. Hue | If Cmax = R′: H = 60 × (((G′ − B′) ÷ Δ) mod 6). If Cmax = G′: H = 60 × ((B′ − R′) ÷ Δ + 2). If Cmax = B′: H = 60 × ((R′ − G′) ÷ Δ + 4) | H is in degrees; add 360 if it is negative. H = 0 when Δ = 0 |
Worked example 1: take rgb(255, 87, 51), the HEX color #FF5733. R′ = 1, G′ ≈ 0.341 and B′ = 0.2, so Cmax = 1, Cmin = 0.2 and Δ = 0.8. Lightness is (1 + 0.2) ÷ 2 = 0.6, or 60%. Saturation is 0.8 ÷ (1 − |1.2 − 1|) = 0.8 ÷ 0.8 = 1, or 100%. Because red is the largest value, hue is 60 × ((0.341 − 0.2) ÷ 0.8) ≈ 10.6, which rounds to 11°. The result is hsl(11, 100%, 60%).
Worked example 2: take rgb(122, 163, 204). Cmax is blue at 0.8 and Cmin is red at about 0.478, so Δ is about 0.322. Lightness is about 0.639, or 64%. Saturation is about 0.446, or 45%. Because blue is the largest value, hue is 60 × ((0.478 − 0.639) ÷ 0.322 + 4) = 210°. The result is hsl(210, 45%, 64%), a soft sky blue. Type those RGB numbers into the converter above to confirm both examples.
This cheat sheet lists popular colors in RGB, HEX and HSL. It is a useful quick reference, and it shows how the hue angle lines up with the color wheel.
| Color | RGB | HEX | HSL |
|---|---|---|---|
| Red | 255, 0, 0 | #FF0000 | hsl(0, 100%, 50%) |
| Orange | 255, 165, 0 | #FFA500 | hsl(39, 100%, 50%) |
| Yellow | 255, 255, 0 | #FFFF00 | hsl(60, 100%, 50%) |
| Green | 0, 255, 0 | #00FF00 | hsl(120, 100%, 50%) |
| Cyan | 0, 255, 255 | #00FFFF | hsl(180, 100%, 50%) |
| Blue | 0, 0, 255 | #0000FF | hsl(240, 100%, 50%) |
| Magenta | 255, 0, 255 | #FF00FF | hsl(300, 100%, 50%) |
| Black | 0, 0, 0 | #000000 | hsl(0, 0%, 0%) |
| White | 255, 255, 255 | #FFFFFF | hsl(0, 0%, 100%) |
| Gray | 128, 128, 128 | #808080 | hsl(0, 0%, 50%) |
Notice that black, white and gray all show a hue of 0 and a saturation of 0. When the three RGB values are equal there is no dominant color, so hue has no real meaning and is simply written as 0.
HSL describes color in the way people naturally think about it. Instead of mixing red, green and blue light, you choose a base color, decide how vivid it should be and decide how light or dark it should be. That makes HSL much easier to adjust by hand than RGB or HEX.
| Hue angle | Color | Example |
|---|---|---|
| 0° or 360° | Red | hsl(0, 100%, 50%) |
| 60° | Yellow | hsl(60, 100%, 50%) |
| 120° | Green | hsl(120, 100%, 50%) |
| 180° | Cyan | hsl(180, 100%, 50%) |
| 240° | Blue | hsl(240, 100%, 50%) |
| 300° | Magenta | hsl(300, 100%, 50%) |
All of these formats can describe the same color. They simply organize the numbers differently, and each is handy in a different situation. The table below compares the four formats you will meet most often on the web and in design tools, using the same orange-red color.
| Format | Example | How it works | Best for |
|---|---|---|---|
| RGB | rgb(255, 87, 51) | Amount of red, green and blue light, 0 to 255 each | Screens, canvas, image processing |
| HEX | #FF5733 | RGB written in base 16 | Compact color codes in CSS and design tools |
| HSL | hsl(11, 100%, 60%) | Hue angle, saturation and lightness | Themes, shades, hover states, color palettes |
| HSB / HSV | hsb(11, 80%, 100%) | Hue angle, saturation and brightness (value) | Color pickers in many design apps |
The big difference between HSL and HSB is how they treat the top of the scale. In HSL, 100% lightness is always white. In HSB, 100% brightness is the brightest version of the color, not white. That is why the same color can show different saturation numbers in each model.
RGB is how screens produce color, but HSL is how people prefer to think about it. Converting RGB to HSL turns hard-to-adjust numbers into three meaningful controls. Here are the most popular reasons developers and designers use an RGB to HSL converter.
Every modern browser understands HSL, so you can use the converted value anywhere you would use a HEX or RGB color. The classic syntax uses commas, and the modern syntax uses spaces. Both describe the same color. For example, a text color can be written as color: hsl(11, 100%, 60%); or as color: hsl(11 100% 60%);. Because the hue, saturation and lightness are separate numbers, it is simple to build a complete color system from one starting point.
:root {
--h: 11;
--s: 100%;
--brand: hsl(var(--h) var(--s) 60%);
--brand-dark: hsl(var(--h) var(--s) 45%);
--brand-light: hsl(var(--h) var(--s) 90%);
}
With this setup, changing the single --h value recolors the whole theme, and every shade stays consistent. This is one of the main reasons developers search for an RGB to HSL CSS converter: it turns one existing brand color into a flexible system.
If you need to convert RGB to HSL in your own code, the function below follows the same formula as this tool. It takes red, green and blue values from 0 to 255 and returns hue in degrees plus saturation and lightness as percentages.
function rgbToHsl(r, g, b) {
r /= 255; g /= 255; b /= 255;
const max = Math.max(r, g, b), min = Math.min(r, g, b);
const d = max - min;
const l = (max + min) / 2;
let h = 0, s = 0;
if (d !== 0) {
s = d / (1 - Math.abs(2 * l - 1));
if (max === r) h = 60 * (((g - b) / d) % 6);
else if (max === g) h = 60 * ((b - r) / d + 2);
else h = 60 * ((r - g) / d + 4);
}
if (h < 0) h += 360;
return [Math.round(h), Math.round(s * 100), Math.round(l * 100)];
}
Calling rgbToHsl(255, 87, 51) returns [11, 100, 60]. You can use this converter to double-check the output of your own implementation.
One of the biggest advantages of HSL is that classic color harmonies become simple math on the hue angle. Convert your starting color to HSL, then add or subtract degrees from the hue while keeping saturation and lightness the same.
| Scheme | Hue shift | Example from hsl(11, 100%, 60%) |
|---|---|---|
| Complementary | +180° | hsl(191, 100%, 60%) |
| Analogous | ±30° | hsl(341, 100%, 60%) and hsl(41, 100%, 60%) |
| Triadic | +120° and +240° | hsl(131, 100%, 60%) and hsl(251, 100%, 60%) |
| Split complementary | +150° and +210° | hsl(161, 100%, 60%) and hsl(221, 100%, 60%) |
Hue wraps around at 360°, so if a shift goes past 360 you subtract 360. Paste any of these HSL results back into your project, or enter the matching RGB values in this converter to double-check them.
Most designers use whole numbers for HSL, such as hsl(11, 100%, 60%), and that is accurate enough for almost every project. If you need extra detail, switch the precision setting to one decimal place. Keep in mind that rounding can introduce a very small difference when you convert from RGB to HSL and back again: the new RGB values may differ from the originals by one step. For that reason, keep your original RGB or HEX value as the master color and treat the HSL value as a convenient working format.
Another detail worth knowing: for pure grays the hue is undefined, so converters (including this one) show 0. That is expected and does not affect the color.
Brand teams, developers and designers often have an entire palette to convert. The bulk converter above reads one color per line and accepts several writing styles, so you can paste straight from a style guide, a spreadsheet or a stylesheet. These lines are all valid:
Each valid line becomes a row with a swatch, the HSL value and the HEX code. Lines that cannot be read as a color are marked as invalid so you can fix them quickly. Use Copy HSL list to paste values into your CSS, or Copy as CSV to move the results into Excel or Google Sheets.
The H in HSL is a position on a circle measured in degrees. These reference points make an HSL value easier to read at a glance. The examples use 100% saturation and 50% lightness.
| Hue | Color name | HEX | HSL value |
|---|---|---|---|
| 0 degrees | Red | #FF0000 | hsl(0, 100%, 50%) |
| 30 degrees | Orange | #FF8000 | hsl(30, 100%, 50%) |
| 60 degrees | Yellow | #FFFF00 | hsl(60, 100%, 50%) |
| 90 degrees | Chartreuse | #80FF00 | hsl(90, 100%, 50%) |
| 120 degrees | Lime green | #00FF00 | hsl(120, 100%, 50%) |
| 180 degrees | Cyan | #00FFFF | hsl(180, 100%, 50%) |
| 210 degrees | Azure | #007FFF | hsl(210, 100%, 50%) |
| 240 degrees | Blue | #0000FF | hsl(240, 100%, 50%) |
| 270 degrees | Violet | #7F00FF | hsl(270, 100%, 50%) |
| 300 degrees | Magenta | #FF00FF | hsl(300, 100%, 50%) |
| 330 degrees | Rose | #FF0080 | hsl(330, 100%, 50%) |
You can store the parts of a color separately and reuse them. For example, declare --brand-h: 220; and --brand-s: 70%;, then write hsl(var(--brand-h) var(--brand-s) 50%) for the main color and hsl(var(--brand-h) var(--brand-s) 95%) for a pale background. Changing one hue variable then updates the related colors together. Review the results after any hue change, because contrast can shift even when lightness numbers stay the same.
Python includes the colorsys module. Its function is named rgb_to_hls and returns hue, lightness and saturation in that order, which is a frequent source of mistakes. Pass values from 0 to 1, as in h, l, s = colorsys.rgb_to_hls(r/255, g/255, b/255). Then multiply h by 360 and multiply s and l by 100 to get CSS style numbers.
Two colors with 50% lightness can look very different in brightness. Pure yellow at that setting appears much lighter than pure blue. For this reason, HSL lightness cannot tell you whether text is readable. WCAG contrast uses relative luminance, which weights red, green and blue differently. After you build shades in HSL, test the real pairs in the Contrast Checker.
These ranges are rough starting points rather than strict definitions.
Compare with value based numbers in the RGB to HSV Converter, copy a web code from the RGB to HEX Converter, or build a numbered scale with the Tailwind Color Palette Generator.
Our free RGB to HSL converter is built to make color conversion simple for developers, designers, students and marketers. Choose your RGB or HEX color, watch the HSL, HEX and HSB codes update live, explore shades with one click and copy whatever you need. For long palettes, switch to the bulk converter and export the results in seconds. Everything runs in your browser, so there is no signup, no upload and no waiting.
Ready to try it? Scroll back up, enter your RGB values and get the HSL code right away. If you work with colors often, explore the other free color and design tools on our site.
Quick answers about converting RGB to HSL, the conversion formula, using HSL in CSS and how it differs from HEX and HSB.
Enter the red, green and blue values (0 to 255) with the sliders or number boxes, or paste an rgb() or HEX value. The converter instantly shows the hue in degrees plus saturation and lightness in percent. You can copy the result as hsl(), in the modern space syntax or as plain values. It is free and needs no signup.
Divide R, G and B by 255, then find the largest value (Cmax), the smallest value (Cmin) and their difference (Δ). Lightness is (Cmax + Cmin) ÷ 2. Saturation is 0 when Δ is 0, otherwise Δ ÷ (1 − |2L − 1|). Hue is calculated from whichever channel is largest. For example, rgb(255, 87, 51) gives hsl(11, 100%, 60%).
A HEX code is just RGB written in base 16. Paste the HEX code, with or without the hash sign, into the paste field and the tool reads the red, green and blue parts and shows the matching HSL value instantly. For example, #FF5733 becomes hsl(11, 100%, 60%).
Hue is the basic color as an angle on the color wheel from 0° to 360°, where red is 0°, green is 120° and blue is 240°. Saturation is how vivid the color is, from 0% (gray) to 100% (fully vivid). Lightness is how light or dark it is, from 0% (black) to 100% (white), with 50% showing the pure color.
HSL makes colors easy to adjust by hand. To create a darker hover color you only lower the lightness, and to mute a color you lower the saturation. You can also keep the hue in a CSS variable and build a whole set of consistent shades and themes from it, which is much harder with HEX or RGB numbers.
No. Both use hue, but the other two values are defined differently. In HSL, 100% lightness is always white. In HSB (also called HSV), 100% brightness gives the brightest version of the color. This is why the same color shows different saturation numbers in each model. This tool shows both HSL and HSB for every color.
Yes. The converter is free, needs no account and works entirely in your browser, so the colors you enter are not uploaded to a server. It also supports a bulk mode for up to 500 colors at once.
Convert RGB to HSL, pick colors from images, generate color palettes or check color contrast in seconds. Explore free color tools to find, convert and perfect all your colors in one place.
Explore All Color Tools →