HSL to RGB Converter
Welcome to the comprehensive HSL to RGB color space converter designed to help web designers, developers, and digital artists convert HSL (Hue, Saturation, Lightness) colors to RGB (Red, Green, Blue) format with accurate calculations and detailed mathematical formulas.
Interactive HSL to RGB Converter
HSL Input
RGB Output
HSL Input Values
Conversion Results
Understanding HSL Color Model
What is HSL?
HSL (Hue, Saturation, Lightness) is a cylindrical color model that represents colors in a way more intuitive for human perception than RGB. HSL separates color information (hue) from its lightness and colorfulness (saturation), making it easier to create color variations, adjust brightness, and build harmonious color schemes. HSL is widely used in CSS and design software because it allows designers to manipulate colors by adjusting single parameters while maintaining color relationships.
HSL Components Explained
- Hue (H): The color type on a 360° color wheel. 0°/360° = Red, 60° = Yellow, 120° = Green, 180° = Cyan, 240° = Blue, 300° = Magenta
- Saturation (S): Color intensity from 0% (gray/no color) to 100% (fully saturated pure color)
- Lightness (L): Brightness from 0% (black) through 50% (pure color) to 100% (white)
- Pure Colors: Occur at S=100% and L=50%
- Grayscale: Any color with S=0% regardless of hue value
HSL to RGB Conversion Formulas
Step 1: Normalize HSL Values
\[ H' = \frac{H}{360}, \quad S' = \frac{S}{100}, \quad L' = \frac{L}{100} \]
Convert H to 0-1 range (divide by 360), S and L to 0-1 range (divide by 100)
Step 2: Calculate Chroma and Intermediate Values
\[ C = (1 - |2L' - 1|) \times S' \] \[ X = C \times \left(1 - \left|\left(\frac{H}{60°} \bmod 2\right) - 1\right|\right) \] \[ m = L' - \frac{C}{2} \]
C = chroma (color intensity), X = intermediate value, m = lightness adjustment
Step 3: Assign RGB' Based on Hue
\[ (R', G', B') = \begin{cases} (C, X, 0) & \text{if } 0° \leq H < 60° \\ (X, C, 0) & \text{if } 60° \leq H < 120° \\ (0, C, X) & \text{if } 120° \leq H < 180° \\ (0, X, C) & \text{if } 180° \leq H < 240° \\ (X, 0, C) & \text{if } 240° \leq H < 300° \\ (C, 0, X) & \text{if } 300° \leq H < 360° \end{cases} \]
Step 4: Convert to RGB (0-255)
\[ R = (R' + m) \times 255 \] \[ G = (G' + m) \times 255 \] \[ B = (B' + m) \times 255 \]
Add lightness adjustment (m) and scale to 0-255 range
Common HSL to RGB Conversions
| Color Name | HSL | RGB | Hex |
|---|---|---|---|
| Red | HSL(0°, 100%, 50%) | RGB(255, 0, 0) | #FF0000 |
| Yellow | HSL(60°, 100%, 50%) | RGB(255, 255, 0) | #FFFF00 |
| Green | HSL(120°, 100%, 50%) | RGB(0, 255, 0) | #00FF00 |
| Cyan | HSL(180°, 100%, 50%) | RGB(0, 255, 255) | #00FFFF |
| Blue | HSL(240°, 100%, 50%) | RGB(0, 0, 255) | #0000FF |
| Magenta | HSL(300°, 100%, 50%) | RGB(255, 0, 255) | #FF00FF |
| White | HSL(0°, 0%, 100%) | RGB(255, 255, 255) | #FFFFFF |
| Black | HSL(0°, 0%, 0%) | RGB(0, 0, 0) | #000000 |
| Gray | HSL(0°, 0%, 50%) | RGB(128, 128, 128) | #808080 |
Detailed Conversion Example
Example: Convert HSL(210°, 80%, 60%) to RGB
Step 1: Normalize values
H' = 210/360 = 0.583
S' = 80/100 = 0.80
L' = 60/100 = 0.60
Step 2: Calculate C, X, m
C = (1 - |2(0.60) - 1|) × 0.80 = (1 - 0.20) × 0.80 = 0.64
H/60 = 210/60 = 3.5, so (H/60 mod 2) = 1.5
X = 0.64 × (1 - |1.5 - 1|) = 0.64 × 0.5 = 0.32
m = 0.60 - (0.64/2) = 0.60 - 0.32 = 0.28
Step 3: Assign RGB' (180° ≤ 210° < 240°)
R' = 0, G' = 0.32, B' = 0.64
Step 4: Convert to RGB
R = (0 + 0.28) × 255 = 71
G = (0.32 + 0.28) × 255 = 153
B = (0.64 + 0.28) × 255 = 235
Result: RGB(71, 153, 235) or #4799EB
Advantages of HSL Color Model
Intuitive Color Manipulation
HSL allows designers to adjust colors in ways that match human perception. Increasing lightness makes colors lighter without changing hue. Decreasing saturation makes colors more muted without affecting brightness. This intuitive control makes HSL superior to RGB for creating color variations, tints, shades, and tones.
Color Scheme Generation
HSL excels at generating harmonious color palettes. Complementary colors are 180° apart in hue. Analogous colors are 30° apart. Triadic schemes use three colors at 120° intervals. Keeping saturation and lightness constant while varying hue creates cohesive color schemes automatically.
CSS Native Support
Modern browsers fully support HSL in CSS via the hsl() and hsla() functions. This native support makes HSL practical for web development without conversion overhead. CSS preprocessors like Sass provide built-in HSL manipulation functions (adjust-hue, lighten, darken, saturate, desaturate) that simplify programmatic color generation.
Practical Applications
Web Design and Development
Web designers use HSL to create accessible color schemes with consistent contrast ratios. HSL's lightness component correlates directly with perceived brightness, making it easier to ensure WCAG contrast compliance. Developers use HSL in CSS custom properties to create dynamic theming systems where changing a single hue value updates colors throughout an application while maintaining lightness relationships.
Dynamic Color Generation
JavaScript frameworks leverage HSL for runtime color manipulation. Generating hover states, active states, or disabled states becomes trivial by adjusting lightness values. Color pickers often use HSL internally because the hue wheel provides intuitive color selection, while separate saturation and lightness controls allow fine-tuning.
Design Systems
Modern design systems use HSL to generate color palettes programmatically. A base hue combined with systematic saturation and lightness variations creates complete color scales. This approach ensures visual consistency and reduces manual color specification. Design tokens often store colors as HSL values for maximum flexibility in generating theme variations.
Common Questions
Why convert HSL to RGB?
While modern browsers support HSL natively in CSS, many graphics APIs, image processing libraries, and older systems require RGB values. Converting HSL to RGB enables use of intuitive HSL color selection with legacy systems that only accept RGB. Additionally, some color manipulations and calculations are more efficient in RGB space, requiring conversion from HSL.
Is HSL to RGB conversion lossy?
No, HSL to RGB conversion is mathematically precise and reversible. Converting HSL → RGB → HSL returns the exact original values (accounting for rounding). Both color spaces can represent the same range of colors—they're just different ways of describing the same colors. The conversion formulas are deterministic with no information loss.
What is the difference between HSL and HSV?
HSL (Hue, Saturation, Lightness) and HSV (Hue, Saturation, Value/Brightness) differ in their third component. In HSL, L=50% represents pure colors, while L=0% is black and L=100% is white. In HSV, V=100% with S=100% gives pure colors, and V=0% is always black. HSL is preferred in CSS because middle lightness values (40-60%) produce vibrant colors useful for accessible designs. HSV is common in image editing software where brightness adjustments feel more natural.
Can I use HSL for all colors?
Yes, HSL can represent any color displayable on screens (same gamut as RGB). However, hue is undefined for grayscale colors (S=0% or L=0% or L=100%). By convention, H=0° for grayscale, but any hue value produces the same result since saturation removes all color. This is not a limitation—it's a mathematical property of cylindrical color spaces.
How do I create color variations with HSL?
To create lighter versions, increase L toward 100%. For darker versions, decrease L toward 0%. For more vivid colors, increase S toward 100%. For muted/pastel colors, decrease S toward 0%. For complementary colors, add 180° to H. For analogous colors, add/subtract 30° to H. This systematic approach to color manipulation is HSL's greatest advantage over RGB.
Why Choose RevisionTown Resources?
RevisionTown is committed to providing accurate, user-friendly calculators and educational resources across diverse topics. While we specialize in mathematics education for curricula like IB, AP, GCSE, and IGCSE, we also create practical tools for technical applications like this HSL to RGB converter.
Our converter combines mathematical precision with interactive visualizations and instant color previews to help web designers, developers, and students understand color space conversions and apply them effectively in their projects.
About the Author
Adam
Co-Founder at RevisionTown
Math Expert specializing in various curricula including IB, AP, GCSE, IGCSE, and more
Adam brings extensive experience in mathematics education and creating practical educational tools. As co-founder of RevisionTown, he combines analytical precision with user-focused design to develop calculators and resources that serve students, professionals, and individuals across various domains. His commitment to accuracy and clarity extends to all RevisionTown projects, ensuring users receive reliable, easy-to-understand information for their needs.
Note: This HSL to RGB converter uses standard color space conversion formulas as defined in CSS Color Module specifications. Hue ranges from 0-360 degrees, while Saturation and Lightness range from 0-100%. Conversions are mathematically precise with no loss of information. All output follows W3C standards and is compatible with modern browsers. For colors with transparency, use HSLA format with an alpha channel or convert to RGBA format. Always verify colors across different displays to account for monitor calibration variations.

