How do I convert HEX to HSL?
Split the HEX code into red, green and blue, divide each channel by 255, then find the maximum and minimum. Lightness is (max + min) ÷ 2. For #2563eb the channels are 37, 99 and 235, which gives hsl(221, 83%, 53%).
To convert HEX to HSL, turn the HEX code into RGB, then work out hue (0–360°), saturation and lightness (0–100%): #3B82F6 = hsl(217, 91%, 60%). Paste any HEX code below to convert it instantly.
Paste a HEX code and get the matching HSL or HSLA value instantly. The live preview keeps alpha, and every format is ready to copy into CSS.
Take #2563eb and read the three pairs: 25, 63 and eb. They become 37, 99 and 235, or 0.145, 0.388 and 0.922 once divided by 255. Lightness is (0.922 + 0.145) ÷ 2 = 0.533, saturation works out to 0.832, and hue is 221°. The result is hsl(221, 83%, 53%).
Rotate the hue 180° to get the complement in the color wheel tool; change lightness in steps with the color shades generator.
#2563ebrgb(37, 99, 235)hsl(221, 83%, 53%)| Color | HEX | RGB | HSL |
|---|---|---|---|
| White | #ffffff | rgb(255, 255, 255) | hsl(0, 0%, 100%) |
| Black | #000000 | rgb(0, 0, 0) | hsl(0, 0%, 0%) |
| Blue | #2563eb | rgb(37, 99, 235) | hsl(221, 83%, 53%) |
| Red | #ef4444 | rgb(239, 68, 68) | hsl(0, 84%, 60%) |
| Green | #22c55e | rgb(34, 197, 94) | hsl(142, 71%, 45%) |
| 50% transparent blue | #2563eb80 | rgba(37, 99, 235, 0.502) | hsla(221, 83%, 53%, 0.502) |
Split the HEX code into red, green and blue, divide each channel by 255, then find the maximum and minimum. Lightness is (max + min) ÷ 2. For #2563eb the channels are 37, 99 and 235, which gives hsl(221, 83%, 53%).
#2563eb is hsl(221, 83%, 53%). Hue 221 is the blue-violet angle, saturation 83% describes how vivid the color is, and lightness 53% places it just above the middle of the black-to-white scale.
Use hsla() and add alpha as a decimal from 0 to 1. The same blue at 50% opacity is hsla(221, 83%, 53%, 0.5). This converter keeps the alpha when you paste an eight-digit HEX such as #2563eb80.