Astronomical Code Logo

Astronomical Code

Toolbox
Back to all tools

RGB to HSL Color Converter

Convert RGB color values to HSL (Hue, Saturation, Lightness) format quickly and easily.

Enter RGB Values

Click on the color picker to select a color visually

HSL Result

How It Works

RGB (Red, Green, Blue) and HSL (Hue, Saturation, Lightness) are two different color models used to represent colors.

RGB is an additive color model where colors are created by combining different intensities of red, green, and blue light. Each component ranges from 0 to 255.

HSL is a more intuitive color model that represents colors based on:

  • Hue: The base color, represented as a degree on the color wheel (0° to 360°)
  • Saturation: The intensity or purity of the color (0% to 100%)
  • Lightness: How light or dark the color is (0% to 100%)

Converting from RGB to HSL involves several steps:

  1. Normalize RGB values to the range [0, 1]
  2. Find the maximum and minimum values among the RGB components
  3. Calculate lightness as the average of max and min
  4. Calculate saturation based on lightness and the difference between max and min
  5. Calculate hue based on which RGB component is the maximum
  6. Convert the results to the appropriate units (degrees for hue, percentages for saturation and lightness)

HSL is particularly useful for color manipulation because it separates the color (hue) from its intensity (saturation) and brightness (lightness), making it easier to create variations of a color by adjusting just one component.

We value your privacy

We use cookies to enhance your browsing experience, serve ads, and analyze our traffic. By clicking "Accept All", you consent to our use of cookies.