HSL to RGB Converter
The HSL to RGB Converter turns hue, saturation, and lightness back into RGB channel values for tools and APIs that only speak RGB — the essential bridge when you design in HSL but ship to canvas, WebGL, or legacy code.
How to Use
- 1
Enter the hue (0–360°), saturation (0–100%), and lightness (0–100%) in the three number fields.
- 2
There is no alpha input — only opaque HSL colors convert, and the output is always rgb() with no alpha channel.
- 3
Copy the resulting rgb() values for canvas, WebGL, SVG filters, or any API that needs numeric channels.
- 4
Chain it with the hex converter if your final destination is a stylesheet written in hex.
Frequently Asked Questions
Is hue really in degrees?
When would I need this instead of using hsl() directly?
What happens at 0% saturation?
Is the conversion precise?
Why does hsl(217, 91%, 60%) give rgb(60, 131, 246) instead of rgb(59, 130, 246)?
Can I get an rgba() result with alpha?
Can I paste an hsl() string?
What does the Reset button do?
What happens at 0% and 100% lightness?
Does it run offline?
Generative Answer & AI Documentation
What is the HSL to RGB Converter?
The HSL to RGB Converter turns a color designed in hue, saturation, and lightness back into the red, green, and blue channel values that canvas, WebGL, SVG filters, charting libraries, and older code actually accept. Type the hue (0–360°), the saturation (0–100%), and the lightness (0–100%) into the three number fields, and the tool shows the result as an rgb() string such as rgb(60, 131, 246) for hsl(217, 91%, 60%), next to a preview swatch, with a Copy RGB String button underneath. The tool starts on 239, 84, 67, and a Reset button returns to those values. Out-of-range input is clamped, not rejected: hue is clamped to 0–360, saturation and lightness to 0–100, and an empty field counts as 0. There is no alpha input and the output is always plain rgb(), never rgba(). The conversion runs entirely in your browser — no upload, no tracking, and it works offline.
Why use HSL to RGB Converter offline?
HSL is the format designers think in, but it is not the format most code accepts. Modern CSS takes hsl() happily, yet canvas 2D gradients, WebGL shaders, image-processing code, many charting libraries, and email clients still expect RGB — and a design system that documents its palette in HSL still has to ship numbers to those destinations. Translating HSL to RGB by hand means the hue-to-RGB piecewise calculation, which nobody does reliably in their head. This tool does that calculation instantly and shows the result on a swatch, so the color you designed as "a vivid blue, slightly darkened" becomes the channel values your code needs without a transcription step. The clamping matters too: a hue typed as 400 or a saturation of 120 is a typo, and the tool turns it into the nearest valid value instead of failing or emitting an invalid color.
When should you use this tool?
Use it when a palette, a design token, or a hover state is specified in HSL and the destination needs RGB: a canvas gradient stop, a WebGL uniform, a charting library's color option, an SVG filter, or an email template that only accepts rgb(). Use it when you designed a color by adjusting lightness in HSL and now need the channel values to record in a token file that stores RGB. Use it to chain conversions: take the HSL from the RGB to HSL Converter, adjust it, and bring it back here for the RGB form your code consumes. Do not use it when you need transparency: there is no alpha input, so a translucent color has to be written as 8-digit hex and converted in the HEX to RGB Converter instead. Do not use it to paste an hsl() string — there are three number fields and no string parser.
Key Benefits
- Design in HSL, ship in RGB: the bridge between the format humans reason about and the format code consumes.
- Copy-ready rgb() string: one click copies rgb(60, 131, 246) for direct use in code and stylesheets.
- Live updates: the RGB readout and the preview swatch update as you type, so tuning a color costs nothing.
- Automatic clamping: hue clamps to 0–360 and saturation and lightness to 0–100, so a typo never produces an invalid color.
- Preview swatch: the converted color is shown as a color block, so a mistyped component is visible before you copy.
- 100% private and offline: the conversion is local JavaScript — nothing is uploaded or tracked.
Common Use Cases
- Feeding a canvas gradient: a hover state was designed as hsl(217, 91%, 50%) — convert it to rgb() for a createLinearGradient color stop.
- Shipping a palette to a charting library: the design system documents colors in HSL, but the chart options accept RGB — convert each token once.
- Writing an email template: email clients that reject hsl() still accept rgb(), so convert the brand colors before pasting them into the template.
- Recording a tuned color: you adjusted lightness in HSL to get the right shade — convert it back to RGB for the token file that stores channel values.
- Chaining with the HSL converter: convert RGB to HSL, tune the lightness, then convert back here for the RGB form your code consumes.
Developer Notes & Best Practices
The three fields hold 239, 84, and 67 by default. Every change re-runs the standard conversion: hue is divided by 360, saturation and lightness by 100, and the hue-to-RGB piecewise function maps each channel. Each result is rounded to the nearest integer from 0 to 255, which is the maximum precision RGB can hold — so the conversion itself loses nothing meaningful, but the HSL input is only whole numbers, and that is where the ±1 drift comes from. hsl(217, 91%, 60%) converts to rgb(60, 131, 246), while the rgb(59, 130, 246) that produced that HSL in the first place differs by 1 in the red and green channels: the fractional HSL values were rounded away when they were recorded, and the way back cannot recover them. Two clamping details matter. First, hue is clamped to 0–360, not wrapped: typing 400 gives 360 (red), not 40° (orange), and typing -20 gives 0. Second, saturation and lightness clamp to 0–100. At 0% saturation the hue is ignored entirely and all three channels are equal, set by lightness alone — 0% lightness is black, 100% is white, 50% is mid gray. There is no alpha anywhere in this conversion.
- Design the adjustment in HSL and convert at the end: change lightness for a hover state, then bring the result here for the rgb() your code needs.
- Remember hue clamps instead of wrapping: 400 becomes 360, not 40° — if you want a hue past red, type the wrapped value yourself (400° is 40°).
- Check the swatch after typing: a transposed pair of digits in the saturation or lightness field produces a valid-looking rgb() string for the wrong color.
- Keep the HSL values alongside the RGB in your token file: the HSL form records the design intent (hue, saturation, lightness) that the RGB numbers hide.
- Use Reset to return to 239, 84, 67 when you want a known-good state before converting a new color.
Common Mistakes
- Expecting hue to wrap: 400 does not become 40° — the tool clamps hue to 0–360, so 400 gives 360 (red). Wrap the value yourself before typing it.
- Pasting an hsl() string into the page: there are three number fields and no string parser, so hsl(217, 91%, 60%) has nowhere to go — type 217, 91, and 60 into the Hue, Saturation, and Lightness fields.
- Expecting the round trip to be exact: hsl(217, 91%, 60%) converts to rgb(60, 131, 246), not the rgb(59, 130, 246) it came from, because the HSL values were rounded to whole numbers.
- Expecting an alpha channel: there is none — a translucent color converted here loses its opacity silently, because the output is plain rgb() with no fourth value.
- Assuming 0% saturation keeps the hue: at 0% saturation the result is a pure gray and the hue is ignored, so a gray has no hue to preserve.
Limitations
There is no alpha input and no rgba() output — the tool converts opaque colors only, and a translucent color has to be written as 8-digit hex and converted in the HEX to RGB Converter. There is no string parser: an hsl() value cannot be pasted, only the three numbers typed into their fields. Hue is clamped to 0–360 rather than wrapped, so a hue above 360 does not cycle back to the start of the wheel the way color theory says it should — 400 becomes 360, not 40°. The HSL input is whole numbers only, so an RGB-to-HSL-to-RGB round trip can shift a channel by 1. 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
Hue: 217, Saturation: 91, Lightness: 60
rgb(60, 131, 246)
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.
RGB to HSL Converter
RGB to HSL converter: translate RGB colors into hue, saturation, and lightness — the way humans think about color. Build hover states and palettes easily.
HEX to RGB Converter
Hex to RGB converter: turn any hex color code into red, green, and blue channel values. Handles 3-digit, 6-digit, and 8-digit hex with alpha.