HSL to hex converter
Result
To convert HSL to hex, take the chroma C = (1 - |2L - 1|) x S, then X = C x (1 - |(H / 60) mod 2 - 1|) and m = L - C / 2 (with S and L as fractions of 1), place C and X in the red, green and blue slots for the hue's 60 degree sector, add m, multiply by 255 and write each 8-bit channel as two hex digits. For example, hsl(221, 83%, 53%) works out to rgb(36, 99, 235), which is #2463EB. Set hue, saturation and lightness below and the hex code updates live, with RGB, HSV and CMYK alongside.
Select any swatch to convert it.
Paste several hex codes, one per line or comma-separated. Each one becomes a swatch you can copy, and the set can be saved as a palette.
How HSL becomes hex
HSL and hex describe color in very different ways, so the conversion takes two steps. First HSL is turned into RGB by mapping the hue to a base color and then applying saturation and lightness. Then each RGB channel is written as two base 16 digits to form the hex string. HueKit handles both steps together as you drag the sliders.
Why work in HSL at all
HSL is the model designers reach for when they want to adjust a color rather than define one from scratch. Because hue, saturation and lightness are independent, you can hold a hue steady and simply lower the lightness to get a darker shade that still feels like the same color. That is far more intuitive than editing raw hex digits.
- Fix hue and saturation, step lightness, and you get a clean scale.
- Nudge the hue slightly to warm or cool a whole palette at once.
- Drop saturation for muted, sophisticated neutrals.
To go from one color to a full scheme, open the palette generator: it builds harmonies around a color and checks every pair for contrast.
When you need the opposite direction, the hex to RGB converter and the full color converter have you covered.
A worked example
Starting from hsl(221, 83%, 53%):
- Chroma = (1 - |2L - 1|) x S = (1 - 0.0600) x 0.8300 = 0.7802
- H' = H / 60 = 221 / 60 = 3.6833, which lands in sector 3
- X = C x (1 - |H' mod 2 - 1|) = 0.2471
- m = L - C / 2 = 0.5300 - 0.3901 = 0.1399
- Add m to each channel and multiply by 255: rgb(36, 99, 235)
- Write each channel in base 16: #2463EB
Result: #2463EB
Rounding to whole channel values can move a result by one step out of 255 compared with the original color.
Frequently asked questions
How do I convert HSL to hex?
Convert HSL to RGB first, then write each RGB channel as two hex digits. For example, hsl(221, 83%, 53%) becomes rgb(36, 99, 235), which is #2463EB. HueKit does both steps at once, so moving the hue, saturation or lightness slider updates the hex code live.
How do I convert HSL stored as bits to hex?
Rescale the values to degrees and percent first, then convert as usual. Some hardware and file formats store hue, saturation and lightness as 8-bit numbers from 0 to 255: hue in degrees is the value divided by 255 times 360 when 255 means a full turn (check the format, some use 256 steps per turn), and saturation and lightness in percent are the value divided by 255 times 100. After the conversion each RGB channel is one 8-bit number written as two hex digits, so a six digit hex code holds 24 bits.
What do hue, saturation and lightness mean?
Hue is the position on the color wheel in degrees. Saturation is how vivid the color is, from grey to pure. Lightness is how bright it is, from black through the color to white.
Why is HSL good for building color scales?
Because it separates hue from lightness. Keep the hue and saturation fixed and step the lightness to produce a consistent light to dark scale, which is exactly how design systems build tints and shades.
Related tools
Last updated by FusionStudios. Every value on this page is computed by the same functions the tools use. How this is calculated.