Output Color
Loading… Please Wait
About RGB to HSL Converter
Input an RGB value like rgb(0, 255, 255)
and Diversify India’s RGB to HSL converter will convert this value to an HSL color like hsl(180deg, 100%, 50%)
.
RGB color parameters are red, green, and blue. The output HSL color parameters are hue, saturation, and lightness.
Why Convert RGB to HSL?
Converting RGB to HSL is advantageous for applications that need to define and adjust colors based on their hue, saturation, and lightness. HSL (Hue, Saturation, Lightness) provides a more intuitive way to work with colors compared to the RGB model. This format is often preferred in design tools and color pickers for its simplicity and ease of use.
How to Convert RGB to HSL
To convert RGB to HSL, you need to transform the red, green, and blue components from their decimal values into hue, saturation, and lightness.
- Extract the values for Red (R), Green (G), and Blue (B) from the RGB code.
- Example:
rgb(255, 109, 71)
gives R = 255, G = 109, B = 71.
- Example:
- Convert the RGB values to a range of 0 to 1 by dividing by 255.
- R = 255 / 255 ≈ 1
- G = 109 / 255 ≈ 0.43
- B = 71 / 255 ≈ 0.278
- Calculate the minimum and maximum values among the normalized R, G, and B values, and find the difference.
- Max = 1
- Min = 0.278
- Delta = Max – Min = 1 – 0.278 ≈ 0.722
- Calculate Lightness (L).
- L = (Max + Min) / 2
- Example: L = (1 + 0.278) / 2 ≈ 0.639
- Calculate Saturation (S).
- If Delta = 0, S = 0
- If Delta ≠ 0, S = Delta / (1 – |2L – 1|)
- Example: S = 0.722 / (1 – |2 × 0.639 – 1|) = 1
- Calculate Hue (H).
- If Max = R, H = 60 × ((G – B) / Delta % 6)
- If Max = G, H = 60 × ((B – R) / Delta + 2)
- If Max = B, H = 60 × ((R – G) / Delta + 4)
- Example: Max = R, so H = 60 × ((0.43 – 0.278) / 0.722 % 6) ≈ 13
- Convert Lightness (L) and Saturation (S) to a percentage:
- L = 0.639 × 100 ≈ 64%
- S = 1 × 100 ≈ 100%
- Combine the HSL values.
- Example:
hsl(13deg, 100%, 64%)
- Example:
List of Color Tools
- Color Converter: Convert to RGBA, Hex, HSLA, HWB, HSV, or CMYK
- Color Picker: Pick RGBA, Hex, HSLA, HWB, HSV, or CMYK Colors
- Color Mixer: Mix Colors Online for Free
- Random Color Generator
- Color Shades Generator
- Color Contrast Checker
- HSL to RGB Converter
- RGB to RGBA Converter
- RGB to Hex Converter
- RGB to HSLA Converter
- RGB to HWB Converter
- RGB to HSV Converter
- RGB to CMYK Converter