Home › Image Tools › RGB to HSL

RGB to HSL

Type red, green and blue values from 0 to 255 to get the matching HSL, HSV (HSB), HWB and HEX values instantly. Every result has a copy button, and the reverse conversion shows whether the rounded HSL turns back into exactly your RGB.

Last updated:

0–255
0–255
0–255
0–1

1 = fully opaque; adds a / alpha part to the CSS

Enter your values to see the result.
Advertisement
Advertisement

How to use the RGB to HSL

  1. Enter the RGB values. Type red, green and blue from 0 to 255, or click one of the example colors.
  2. Add alpha if needed. Leave alpha at 1 for a solid color or enter 0-1 for transparency.
  3. Pick the precision. Whole numbers are fine for CSS; choose 2 decimals for an exact round trip back to RGB.
  4. Copy the result. Use the Copy buttons next to the CSS HSL, legacy hsl(), HEX, HSV or HWB strings.
  5. Explore tints and shades. Click any swatch in the lightness ramp to copy its HEX code.

RGB to HSL formula

HSL describes a color by its hue (the angle on the color wheel, 0-360°), saturation (how far it is from grey) and lightness (from black at 0% to white at 100%). The converter uses the standard formula from CSS Color Module Level 4:

  1. Scale each channel to 0-1: R′ = R / 255, G′ = G / 255, B′ = B / 255.
  2. Cmax = max(R′, G′, B′), Cmin = min(R′, G′, B′), Δ = Cmax − Cmin.
  3. L = (Cmax + Cmin) / 2.
  4. S = 0 if Δ = 0, otherwise S = Δ / (1 − |2L − 1|).
  5. H = 60° × ((G′ − B′) / Δ mod 6) if Cmax is R′; 60° × ((B′ − R′) / Δ + 2) if Cmax is G′; 60° × ((R′ − G′) / Δ + 4) if Cmax is B′.

HSV/HSB shares the hue; its value is V = Cmax and its saturation is Δ / Cmax.

Common RGB colors in HSL and HSV

ColorRGBHSLHSV / HSBHEX
Red255, 0, 00°, 100%, 50%0°, 100%, 100%#FF0000
Orange255, 165, 039°, 100%, 50%39°, 100%, 100%#FFA500
Yellow255, 255, 060°, 100%, 50%60°, 100%, 100%#FFFF00
Green0, 128, 0120°, 100%, 25%120°, 100%, 50%#008000
Cyan0, 255, 255180°, 100%, 50%180°, 100%, 100%#00FFFF
Sky blue135, 206, 235197°, 71%, 73%197°, 43%, 92%#87CEEB
Blue0, 0, 255240°, 100%, 50%240°, 100%, 100%#0000FF
Purple128, 0, 128300°, 100%, 25%300°, 100%, 50%#800080
Grey128, 128, 1280°, 0%, 50%0°, 0%, 50%#808080
White255, 255, 2550°, 0%, 100%0°, 0%, 100%#FFFFFF

When to use HSL instead of RGB

HSL is easier to adjust by hand: keep the hue and saturation and change only the lightness to build hover states, tints and shades, or rotate the hue by 30° steps for analogous colors. RGB and HEX are what screens and image files store, so convert back with the reverse values when you need exact pixel colors.

Frequently asked questions

How do you convert RGB to HSL?

Divide R, G and B by 255. Find the largest (Cmax) and smallest (Cmin) value and their difference Δ. Lightness L = (Cmax + Cmin) / 2. If Δ = 0 the color is grey (H = S = 0); otherwise S = Δ / (1 − |2L − 1|), and the hue depends on which channel is largest: 60 × ((G − B) / Δ mod 6) for red, 60 × ((B − R) / Δ + 2) for green and 60 × ((R − G) / Δ + 4) for blue.

What is the difference between HSL and HSV (HSB)?

Both use the same hue angle. HSL places pure colors at 50% lightness, with 100% lightness always white. HSV (also called HSB) places pure colors at 100% value, and 100% value with 0% saturation is white. Design tools such as Photoshop and Figma color pickers use HSB, while CSS uses HSL.

Why does converting HSL back to RGB give slightly different numbers?

HSL values are usually rounded to whole degrees and percentages. Rounding can shift a channel by 1 or 2 when you convert back. Choose 2 decimal places and the round trip returns your exact RGB values.

What is RGB 255, 0, 0 in HSL?

Pure red rgb(255, 0, 0) is hsl(0, 100%, 50%) and hsv(0, 100%, 100%).

How do I write HSL in CSS?

Modern CSS accepts hsl(150 39% 30%) with spaces and an optional alpha after a slash, for example hsl(150 39% 30% / 0.5). The older comma syntax hsl(150, 39%, 30%) and hsla(150, 39%, 30%, 0.5) still works in every browser.

What is HWB?

HWB stands for hue, whiteness and blackness. Whiteness is the smallest RGB channel and blackness is 1 minus the largest, both as percentages. It is supported in CSS with hwb() and is easy to adjust by hand.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

HSL to HEXConvert HSL and HSLA colors to HEX and RGB with sliders and a live preview.HEX to HSLConvert HEX colors to HSL and back with interactive sliders.RGB to HEXConvert RGB to HEX with sliders, live swatch and one-click copy.Color PickerPick any color and get HEX, RGB, HSL, HSV and CMYK codes, shades and a screen eyedropper.Color Palette GeneratorGenerate beautiful color palettes and export them.HEX to RGBConvert HEX colors to RGB and other formats.RGB to CMYK ConverterConvert RGB and HEX colors to CMYK for print, and back.Color Contrast CheckerCheck WCAG contrast ratios and find accessible text colors.Pantone to HEXLook up approximate HEX, RGB and CMYK values for Pantone colors.Color Name FinderFind the closest color name for any HEX or RGB color.Color Blindness SimulatorSee any image as people with protanopia, deuteranopia, tritanopia or achromatopsia see itImage Color PickerPick any pixel colour from an image and get HEX, RGB, HSL plus a paletteColor Shades GeneratorTurn one HEX color into a 50-950 scale plus tints, shades and tones, ready to export.Tailwind Color GeneratorTurn one color into a full Tailwind 50–950 shade scale and export the config or CSS.Color MixerMix two colors in sRGB, linear, OKLab or OKLCH, or blend them with Photoshop-style modes.Random Color GeneratorGenerate random HEX colors one at a time or in batches, with hue, saturation and lightness ranges.Color WheelFind complementary, triadic, analogous and other color harmonies on an interactive wheel.HTML Color CodesAll 140 HTML color names with HEX and RGB codes, plus the 216 web-safe colors. Click to copy.Color Palette from ImageExtract the main colors of any photo as HEX codes, CSS variables and a palette PNG.Replace Color in ImageClick a color in a picture and swap it for a new color or transparency, keeping the shading.CMYK to RGBConvert CMYK percentages to RGB and HEX color codes with sliders and a live preview.HEX to RGBAConvert HEX color codes to CSS rgba() with an opacity slider and one-click copy.RGBA to HEXConvert rgba() colors to 8-digit HEX, or flatten transparency onto any background.HEX to CMYKConvert HEX color codes to CMYK percentages for print, with a live preview.HEX to PantoneFind the 5 closest Pantone-style solid coated colors for any HEX or RGB, ranked by Delta E.Color Temperature to RGBConvert a color temperature in kelvin (1000-40000 K) to RGB and HEX with a live swatch.OKLCH Color ConverterConvert HEX, RGB and HSL to OKLCH, OKLab, Lab and LCH with sRGB and P3 gamut checks.RAL to HEXLook up RAL Classic codes as HEX, RGB and CMYK, search by name or find the nearest RAL.Color Code ConverterConvert a color between HEX, RGB, HSL, HSV, CMYK, LAB, LCH and OKLCH with a live swatch.Room Paint Color VisualizerUpload a room photo, select the walls and preview any paint color or HEX with real lighting.Photo to Pop ArtMake Warhol-style pop art from a photo: posterized color tiles in 1, 4 or 9 grids with custom palettes.Screen Color PickerPick any pixel color from anywhere on your screen and copy it as HEX, RGB or HSL.Solid Color Image GeneratorMake a plain single-color or transparent image in any size, like 1920x1080, as PNG or JPG.White Balance CorrectorFix color casts: click a neutral gray point or use auto gray world, then fine-tune temperature and tint.CMYK to HEXConvert CMYK percentages to a HEX color code and RGB, with a live swatch and shades.Photo Color MatchCopy the color grading of a reference photo onto your image (Reinhard color transfer).Underwater Photo Color CorrectionRestore lost reds and remove the blue or green cast from underwater photos by depth.
See all 38 Color Tools →