HSL to RGB

Convert HSL colors to RGB as you type, with a live preview, the formula and a table of common colors converted.

loading HSL to RGB
About this tool

What are HSL and RGB?

HSL describes the same sRGB color as hue (0–360°), saturation and lightness (0–100%), which makes lighter and darker shades easy to write by hand. RGB gives the same three sRGB channels as decimal numbers from 0 to 255, plus an optional alpha.

Canvas code, game engines and LED strips take RGB numbers, while palettes are easier to design in HSL; this page is the bridge.

The color converter below starts from HSL and highlights RGB, next to HWB, LAB, LCH and CSS names.

HSL vs RGB

HSLRGB
Notationhsl(39 100% 57%)rgb(255 178 36), rgb(255, 178, 36)
In CSSall browsersall browsers
Typical usethemes and shades in CSScode that computes colors, canvas, image libraries

Formula

With channels scaled to 0–1: lightness L = (max + min) / 2; saturation S = (max − min) / (1 − |2L − 1|); hue H is the angle of the largest channel (red 0°, green 120°, blue 240°) shifted by the difference of the other two. The reverse builds the channels back from the same three numbers.

What changes in the conversion

  • HSL and RGB describe the same sRGB color; the only difference is rounding of the last digit.
  • Transparency (alpha) is kept: #RRGGBBAA, rgb(… / 0.5), hsl(… / 50%) and oklch(… / 0.5) all carry it.

How to convert HSL to RGB

  1. Type or paste the HSL value in its line, or pick a color with the color picker.
  2. Read the RGB line, which updates as you type, and check the preview swatch.

Common colors from HSL to RGB

Converted with the same code as the tool:

ColorHSLRGB
amber (stdlib.tools accent)hsl(39, 100%, 57%)rgb(255, 178, 36)
tealhsl(189, 85%, 28%)rgb(11, 114, 132)
bluehsl(217, 91%, 60%)rgb(60, 131, 246)
greenhsl(142, 76%, 36%)rgb(22, 162, 73)
redhsl(0, 72%, 51%)rgb(220, 40, 40)
mid grayhsl(0, 0%, 50%)rgb(128, 128, 128)
blackhsl(0, 0%, 0%)rgb(0, 0, 0)
whitehsl(0, 0%, 100%)rgb(255, 255, 255)

Frequently asked questions

Is HSL to RGB exact?

Yes, up to rounding: both describe the same 8-bit sRGB color, so converting back gives the same value.

Which format should I use in CSS?

HEX and rgb() work everywhere; hsl() is handy for shades written by hand; oklch() gives even lightness steps and wide-gamut colors in current browsers.

How do I write RGB with transparency?

Use a slash: rgb(255 178 36 / 50%), or the older rgba(255, 178, 36, 0.5); both mean 50% opacity.

Report a problem