Convert RGB (Red, Green, Blue) color values to HSL (Hue, Saturation, Lightness) model instantly. Perfect for web design, digital art, and CSS styling.
RGB (Red, Green, Blue) is an additive color model used by digital displays, while HSL (Hue, Saturation, Lightness) is a cylindrical representation that corresponds more closely to how humans perceive color. Converting RGB to HSL makes it easier to adjust colors intuitively.
RGB Color Model:
HSL Color Model:
RGB to HSL Conversion Steps:
1. Convert RGB (0-255) to (0-1) range: r = R/255, g = G/255, b = B/255
2. Find maximum and minimum values: max = max(r,g,b), min = min(r,g,b)
3. Calculate lightness: L = (max + min) / 2
4. Calculate saturation:
If max = min: S = 0
Else if L ≤ 0.5: S = (max - min) / (max + min)
Else: S = (max - min) / (2 - max - min)
5. Calculate hue:
If max = min: H = 0
Else if max = r: H = ((g - b) / (max - min)) × 60
Else if max = g: H = (2 + (b - r) / (max - min)) × 60
Else if max = b: H = (4 + (r - g) / (max - min)) × 60
6. Normalize hue: if H < 0, then H = H + 360
7. Convert to percentages: S = S × 100%, L = L × 100%
Web Design and CSS: CSS supports both RGB and HSL color formats. Converting RGB values to HSL makes it easier to create color variations by adjusting the lightness and saturation while maintaining the same hue, which is useful for hover states, gradients, and shadows.
Digital Image Processing: When editing images, converting RGB to HSL allows for more intuitive adjustments. You can easily change the color tone (hue), intensity (saturation), or brightness (lightness) without affecting the other attributes.
Data Visualization: HSL color space is excellent for creating color schemes where you need consistent saturation and lightness across different hues, making charts and graphs easier to read and interpret.
| Color Name | RGB Value | HSL Equivalent | Visual Example |
|---|---|---|---|
| Pure Red | rgb(255, 0, 0) | hsl(0°, 100%, 50%) |
|
| Pure Green | rgb(0, 255, 0) | hsl(120°, 100%, 50%) |
|
| Pure Blue | rgb(0, 0, 255) | hsl(240°, 100%, 50%) |
|
| Yellow | rgb(255, 255, 0) | hsl(60°, 100%, 50%) |
|
| Cyan | rgb(0, 255, 255) | hsl(180°, 100%, 50%) |
|
| Magenta | rgb(255, 0, 255) | hsl(300°, 100%, 50%) |
|
| White | rgb(255, 255, 255) | hsl(0°, 0%, 100%) |
|
| Black | rgb(0, 0, 0) | hsl(0°, 0%, 0%) |
|
| Medium Gray | rgb(128, 128, 128) | hsl(0°, 0%, 50%) |
|