RGB to HSL Converter
The RGB to HSL Converter translates RGB colors into hue, saturation, and lightness — the way humans actually think about color. Designers use HSL to build hover states, tints, and harmonious palettes without guessing channel numbers.
How to Use
- 1
Enter your red, green, and blue values (0–255) in the three number fields.
- 2
Read off the hue (0–360° on the color wheel), saturation (0–100%), and lightness (0–100%).
- 3
Copy the result as hsl(217, 91%, 60%) for direct use in modern CSS.
- 4
Experiment: lower the channel values to preview a darker hover variant — the HSL readout updates live as you type.
Frequently Asked Questions
Why HSL instead of RGB?
What does the hue number mean?
Can I get HSLA with alpha?
Do browsers support hsl() in CSS?
Why does converting back give a slightly different RGB value?
What happens at 0% saturation?
What if a channel value exceeds 255?
Can I paste an rgb() string?
How do I build a hover state from the HSL output?
Is anything uploaded?
Generative Answer & AI Documentation
What is the RGB to HSL Converter?
The RGB to HSL Converter translates a color from the channel numbers machines use into the hue, saturation, and lightness that humans use to think about color. Type the red, green, and blue values — each from 0 to 255 — into the three number fields, and the tool shows the result as an hsl() string such as hsl(217, 91%, 60%) for 59, 130, 246, next to a preview swatch, with a Copy HSL String button underneath. Hue is reported in degrees around the color wheel from 0 to 360, saturation and lightness as whole-number percentages from 0 to 100. The tool starts on 99, 102, 241, which is hsl(239, 84%, 67%), and a Reset button returns to those values. Out-of-range channels are clamped to 0–255 rather than rejected, and an empty field counts as 0. There is no alpha input and the output is always plain hsl(), never hsla(). The conversion runs entirely in your browser — no upload, no tracking, and it works offline.
Why use RGB to HSL Converter offline?
RGB describes a color as three amounts of light, which is precise and completely unintuitive: nothing about the numbers 59, 130, 246 tells you that the color is a vivid blue, or how to make it a little darker for a hover state. HSL separates the three things humans actually perceive — which color it is (hue), how intense it is (saturation), and how bright it is (lightness) — so the adjustments designers make every day become single-number changes: darker means lower lightness, muted means lower saturation, and the complementary color is hue plus 180 degrees. In RGB, that same hover state means recalculating all three channels and hoping the hue did not drift. This tool is the bridge between the two worlds: your picker, your canvas code, or your computed color hands you RGB, and this page hands back the HSL form you can reason about, copy into CSS, and adjust with confidence. Because the output is a ready-to-paste hsl() string, it drops straight into a stylesheet or a design token without reformatting.
When should you use this tool?
Use it when you have RGB numbers — from a picker, a design file, a canvas API, or code that computed a color — and you need to understand or adjust the color the way a human would: finding the hue for a palette, lowering lightness for a hover state, or desaturating a color for a disabled state. Use it when you are building a harmonious palette, because hue arithmetic (complementary at +180°, analogous at ±30°) only makes sense in HSL. Use it when a design system documents colors in HSL and your source data is RGB. Do not use it when you need transparency: there is no alpha input, so a translucent color has to be handled as 8-digit hex in the HEX to RGB Converter instead. Do not use it to paste an rgb() string — there are three number fields and no string parser.
Key Benefits
- Human-readable output: hue in degrees, saturation and lightness in percent — the form designers actually think in.
- Copy-ready hsl() string: one click copies hsl(217, 91%, 60%) for direct use in modern CSS.
- Live updates: the HSL readout and the preview swatch update as you type, so experimenting costs nothing.
- Automatic clamping: channels above 255 become 255 and negatives become 0, so an out-of-range value never breaks the conversion.
- Preview swatch: the converted color is shown as a color block, so a mistyped channel is visible before you copy.
- 100% private and offline: the conversion is local JavaScript — nothing is uploaded or tracked.
Common Use Cases
- Building a hover state: a button is rgb(59, 130, 246) — convert it to hsl(217, 91%, 60%), lower the lightness, and the hover color keeps the same hue.
- Finding a complementary color: read the hue (217°) and add 180° to get the opposite side of the wheel for an accent color.
- Desaturating for a disabled state: convert the brand color, lower the saturation toward gray, and keep the lightness — the state still reads as the same color family.
- Documenting a palette in HSL: convert each palette color's RGB numbers so the design system records hue, saturation, and lightness for every token.
- Checking a computed color: code produced RGB numbers for a chart series — convert them to confirm the hues are spread evenly around the wheel.
Developer Notes & Best Practices
The three fields hold 99, 102, and 241 by default. Each channel is clamped to 0–255 and divided by 255 before the standard conversion runs: lightness is the average of the largest and smallest normalised channels, saturation follows from the spread between them, and hue is computed from which channel is largest, in degrees around the wheel. All three results are rounded to whole numbers — hue to whole degrees, saturation and lightness to whole percent — so the output is always an integer hsl() string such as hsl(217, 91%, 60%). That rounding is the one precision limit worth knowing: converting RGB to HSL and back can shift a channel by 1, because the HSL form cannot hold the fractional values. hsl(217, 91%, 60%) converts back to rgb(60, 131, 246), one step off the rgb(59, 130, 246) it came from. A gray is the special case: when all three channels are equal, the spread is zero, so hue is reported as 0 and saturation as 0%, and lightness alone carries the shade. There is no alpha anywhere in this conversion — no fourth input, and the output string never carries an opacity value.
- Think in hue first: read the hue number, then decide the adjustment — lightness for darker or lighter, saturation for muted or vivid — instead of guessing channel numbers.
- Build hover states by changing lightness alone: the hue stays put, so the state is recognisably the same color, just darker or lighter.
- Find a complementary color by adding 180° to the hue: 217° plus 180° is 37°, wrapping past 360° back to the start of the wheel.
- Treat the hex as the source of truth for exactness: the rounded HSL values can shift a channel by 1 on the way back, so record the hex alongside the HSL.
- Check the swatch after typing: a transposed pair of digits in the RGB fields produces a valid-looking HSL string for the wrong color.
Common Mistakes
- Expecting the round trip to be exact: converting RGB to HSL and back can move a channel by 1 because HSL is rounded to whole numbers — keep the hex as the source of truth when exactness matters.
- Pasting an rgb() string into the page: there are three number fields and no string parser, so rgb(59, 130, 246) has nowhere to go — type the three numbers in.
- Reading hue as a percentage: hue is degrees on the color wheel (0–360), while saturation and lightness are percentages — mixing the scales up produces a wrong color.
- Forgetting that 0% saturation is gray: at 0% saturation the hue number is meaningless (the tool reports 0), so a gray has no hue to preserve or complement.
- Expecting an alpha channel: there is none — a translucent color converted here loses its opacity silently, because the output is plain hsl() with no fourth value.
Limitations
There is no alpha input and no hsla() output — the tool converts opaque colors only, and a translucent color has to be handled as 8-digit hex in the HEX to RGB Converter. There is no string parser: an rgb() value cannot be pasted, only the three numbers typed into their fields. Hue, saturation, and lightness are rounded to whole numbers, so an RGB-to-HSL-to-RGB round trip can shift a channel by 1 — the formats are equivalent to the nearest integer, not bit-identical. Out-of-range channels are silently clamped, so a 300 in the input looks like a successful conversion to 255 instead of a warning. There is no batch mode and no saved history: one color at a time, and closing the tab loses the current values.
Structured Input/Output Example
Red: 59, Green: 130, Blue: 246
hsl(217, 91%, 60%)
Related Tools
Color Converter
Color converter: translate colors between HEX, RGB, HSL and OKLCH with a live preview swatch. Type a hex code or pick visually, then copy clean CSS.
HSL to RGB Converter
HSL to RGB converter: turn hue, saturation, and lightness into RGB channel values for tools and APIs that only speak RGB. Free, offline, instant.
RGB to HEX Converter
RGB to hex converter: turn RGB channel values into compact hex codes like #3b82f6 in one step. Free, offline, private.