Skip to content

RGB to HSL Converter

Convert RGB or HEX to HSL instantly. Adjust sliders, pick colors, paste values or batch convert. Free and no signup.

  • 100% free
  • No Signup
  • Bulk converter

RGB values

Quick presets

HSL result

#FF5733
H11°
S100%
L60%
  • HSL hsl(11, 100%, 60%)
  • HSL modern hsl(11 100% 60%)
  • HSL values 11, 100%, 60%
  • RGB rgb(255, 87, 51)
  • HEX #FF5733
  • HSB / HSV hsb(11, 80%, 100%)
Shades and tints (same hue and saturation, click to use)

Bulk RGB to HSL converter

Paste one color per line (up to 500). Use RGB numbers, rgb(...) or HEX codes.

ColorInputHSLHEX
Your converted colors will appear here.
ADVERTISEMENT
Demo Ad 728 x 90 320 x 100

How to convert RGB to HSL

  1. 1

    Enter RGB or HEX

    Move the sliders, use the color picker or paste an RGB or HEX value.

  2. 2

    See HSL instantly

    Hue, saturation and lightness update live, together with HEX and HSB.

  3. 3

    Copy and use

    Copy the hsl() value for CSS, or pick a ready-made shade from the strip.

COLOR CONVERSION GUIDE

RGB to HSL Converter – Convert RGB and HEX Colors to HSL Online Free

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.

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.

RGB to HSL for CSS

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.

HEX to HSL Supported Too

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.

HSB and HSV Included

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.

Shades and Tints Strip

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.

Bulk RGB to HSL Converter

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.

How to Convert RGB to HSL Online (Step by Step)

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.

  1. Enter your RGB values: Use the Red, Green and Blue sliders, or type each number from 0 to 255 into the boxes.
  2. Or start from another format: Choose a color with the picker, or paste RGB, rgb() or HEX into the paste field and all channels fill in automatically.
  3. Read the HSL result: The HSL chips show hue in degrees, saturation in percent and lightness in percent, next to a large color swatch.
  4. Copy the format you need: Use the Copy buttons for hsl(), the modern hsl syntax, plain HSL values, RGB, HEX or HSB.
  5. Explore shades: Click a shade in the strip to move to a lighter or darker version of the same color, then copy its value.

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.

RGB to HSL Formula Explained

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.

RGB to HSL conversion steps
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.

Common RGB Colors and Their HSL Values

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.

RGB to HSL examples
Color RGB HEX HSL
Red255, 0, 0#FF0000hsl(0, 100%, 50%)
Orange255, 165, 0#FFA500hsl(39, 100%, 50%)
Yellow255, 255, 0#FFFF00hsl(60, 100%, 50%)
Green0, 255, 0#00FF00hsl(120, 100%, 50%)
Cyan0, 255, 255#00FFFFhsl(180, 100%, 50%)
Blue0, 0, 255#0000FFhsl(240, 100%, 50%)
Magenta255, 0, 255#FF00FFhsl(300, 100%, 50%)
Black0, 0, 0#000000hsl(0, 0%, 0%)
White255, 255, 255#FFFFFFhsl(0, 0%, 100%)
Gray128, 128, 128#808080hsl(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.

What Is HSL? Hue, Saturation and Lightness Explained

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 (H): The basic color, given as an angle on the color wheel from 0° to 360°. Red is at 0°, green at 120° and blue at 240°.
  • Saturation (S): How strong or pure the color is, from 0% (a gray) to 100% (a fully vivid color).
  • Lightness (L): How light or dark the color is, from 0% (black) through 50% (the pure color) to 100% (white).
Hue angles on the color wheel
Hue angle Color Example
0° or 360°Redhsl(0, 100%, 50%)
60°Yellowhsl(60, 100%, 50%)
120°Greenhsl(120, 100%, 50%)
180°Cyanhsl(180, 100%, 50%)
240°Bluehsl(240, 100%, 50%)
300°Magentahsl(300, 100%, 50%)

RGB vs HSL vs HEX vs HSB: What Is the Difference?

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.

Color format comparison for #FF5733
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.

Why Convert RGB to HSL? Common Uses

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.

  • Create shades and tints: Keep the hue and saturation, change only the lightness, and you get a clean set of lighter and darker versions of a brand color.
  • Build hover and active states: Make a button 8% darker on hover by lowering lightness instead of guessing new RGB numbers.
  • Design light and dark themes: Swap lightness values while keeping the same hue to produce matching theme colors.
  • Generate color palettes: Rotate the hue by fixed angles to find complementary, analogous and triadic colors.
  • Write cleaner CSS: Store hue, saturation and lightness as CSS custom properties and adjust them with calc().
  • Adjust saturation for accessibility and mood: Mute a color by lowering saturation without changing its basic hue.
  • Learn color theory: Students can see directly how each of the three values changes the final color.
  • Convert color lists in bulk: Designers can move a whole palette from RGB or HEX into HSL tokens in one step.

How to Use HSL Colors in CSS

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.

RGB to HSL in JavaScript

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.

Build Color Palettes With HSL Hue Shifts

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.

Color schemes from hue shifts
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.

Rounding, Accuracy and Round-Trip Conversion

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.

Convert Multiple RGB Colors to HSL at Once

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:

  • Comma separated RGB: 255, 87, 51
  • Space separated RGB: 122 163 204
  • CSS-style notation: rgb(0, 174, 239)
  • HEX codes: #FF5733 or #f53

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.

Common Mistakes When Converting RGB to HSL

  • Using the wrong range: RGB channels go from 0 to 255, not 0 to 100. Hue goes up to 360 and the other two HSL values are percentages.
  • Mixing up HSL and HSB: The same color has different saturation and third-value numbers in each model. Check which one your tool or app expects.
  • Forgetting the percent signs in CSS: In hsl(), saturation and lightness need a percent sign, while hue is a plain number or a number with deg.
  • Expecting every gray to have a hue: Grays have no real hue, so the value is shown as 0.
  • Treating HSL lightness as brightness: At 100% lightness every color becomes white, no matter the hue or saturation.
  • Rounding too early: If you chain several conversions, keep the original value and convert once at the end.

HSL Hue Chart: Degrees and Color Names

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.

HSL hue reference chart
HueColor nameHEXHSL value
0 degreesRed#FF0000hsl(0, 100%, 50%)
30 degreesOrange#FF8000hsl(30, 100%, 50%)
60 degreesYellow#FFFF00hsl(60, 100%, 50%)
90 degreesChartreuse#80FF00hsl(90, 100%, 50%)
120 degreesLime green#00FF00hsl(120, 100%, 50%)
180 degreesCyan#00FFFFhsl(180, 100%, 50%)
210 degreesAzure#007FFFhsl(210, 100%, 50%)
240 degreesBlue#0000FFhsl(240, 100%, 50%)
270 degreesViolet#7F00FFhsl(270, 100%, 50%)
300 degreesMagenta#FF00FFhsl(300, 100%, 50%)
330 degreesRose#FF0080hsl(330, 100%, 50%)

Create CSS Theme Colors With HSL Variables

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.

RGB to HSL in Python

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.

HSL Lightness vs Perceived Brightness and Contrast

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.

Which HSL Values Make Pastel, Muted and Dark Colors?

These ranges are rough starting points rather than strict definitions.

  • Pastel: Medium saturation with high lightness.
  • Vivid: High saturation with mid range lightness.
  • Muted: Lower saturation, often with mid range lightness.
  • Dark theme surfaces: Low saturation with very low lightness.
  • Neutral gray: 0% saturation at any lightness.

Related HSL, RGB and HEX Tools

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.

Free RGB to HSL Converter Online: Fast, Accurate and Private

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.

ADVERTISEMENT
Demo Ad 300 x 250 300 x 250
COMMON QUESTIONS

RGB to HSL Converter FAQ

Quick answers about converting RGB to HSL, the conversion formula, using HSL in CSS and how it differs from HEX and HSB.

How do I convert RGB to HSL?

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.

What is the RGB to HSL formula?

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%).

How do I convert HEX to HSL?

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%).

What do hue, saturation and lightness mean?

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.

Why is HSL useful in CSS?

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.

Is HSL the same as HSB or HSV?

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.

Is this RGB to HSL converter free and private?

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.

ADVERTISEMENT
Demo Ad 728 x 90 320 x 100