HEX to HSL Converter
Color Picker · developer
Convert HEX values to HSL with a fixed input and output format, live preview of the conversion line, and copy-ready results. All processing runs locally in your browser.
Calculator
From: Hexadecimal (#RRGGBB)
To: HSL (hue, saturation, lightness)
About HEX
Hexadecimal codes pack red, green, and blue into six (or eight with alpha) base-16 digits. They are the default in CSS, design tools, and APIs.
About HSL
HSL uses hue (0–360°), saturation (0–100%), and lightness (0–100%). It is convenient for adjusting perceived brightness and vividness.
How to convert HEX to HSL
Enter a valid HEX value in the calculator. The tool follows the pipeline below: parse your input, hold the color as sRGB (with alpha when relevant), then format the result as HSL.
Accepted shapes include CSS-like functions (e.g. rgb(...), hsl(...)) and compact comma-separated numbers where appropriate. Hex may include or omit the leading #.
Conversion procedure
- Parse HEX: optional leading “#” is removed. The parser expects exactly six hexadecimal digits for opaque colors (#RRGGBB), or eight digits when an alpha byte is included (#RRGGBBAA). Each pair is read as base 16 and becomes one channel in the 0–255 range. Invalid length or non-hex characters are rejected.
- Resolve to internal sRGB: after parsing, the color is already expressed as three 8-bit channels. If only six hex digits were given, alpha is set to 1. If eight digits were given, the seventh and eighth nibbles define alpha as (alphaByte ÷ 255).
- Build HSL: RGB is normalized to 0–1. Lightness L = (max + min)/2. Saturation S is 0 if max = min; otherwise S = (max − min) / (max + min) when L ≤ 0.5, or S = (max − min) / (2 − max − min) when L > 0.5. Hue (0–360°) is derived from which channel is maximal and the differences between channels. The page displays integer degrees and whole-number percentages: hsl(h, s%, l%).
- Finalize: the result string is what you copy from the calculator. The line under the fields summarizes the path in short form (HSL ← sRGB ← HEX). Rounding is intentional so values read like typical CSS; tiny differences versus other apps can still appear because of integer hue, saturation, lightness/value, or ink percentages.
- HSL/HSV reminder: when hue, saturation, and lightness/value are shown as whole numbers, more than one underlying RGB can produce the same text. Typing those integers back into a converter may therefore differ by ±1 from a color you first picked as HEX in the Color Picker—that is expected rounding behavior, not a broken formula.
Example
Input (HEX): #3498DB
Output (HSL): hsl(204, 70%, 53%)
Summary
This page converts HEX input into HSL output. The numbered “Conversion procedure” above is the full breakdown: validation and parsing, conversion to a single internal sRGB (+ alpha) sample, derivation of HSL coordinates from that sample, and final rounding to the strings you see in CSS-oriented tools. The same pipeline runs in your browser as you type.
Relationship context
Hexadecimal (#RRGGBB) and HSL (hue, saturation, lightness) are different ways to describe the same sRGB color (except CMYK, which is an approximate ink model). Converting HEX → HSL does not change the underlying color within the limits of each notation; it only changes how numbers are written.
Example conversions
Sample HEX values and the matching HSL output using the same rules as the calculator.
| HEX input | HSL output |
|---|---|
| #000000 | hsl(0, 0%, 0%) |
| #FFFFFF | hsl(0, 0%, 100%) |
| #3498DB | hsl(204, 70%, 53%) |
More color format converters
Other dedicated pages (fixed input and output types). Open the Color Picker for the full list.
- CMYK to HSL ConverterCMYK to HSL
- HEX to CMYK ConverterHEX to CMYK
- HEX to HSV ConverterHEX to HSV
- HEX to RGB ConverterHEX to RGB
- HEX to RGBA ConverterHEX to RGBA
- HSV to HSL ConverterHSV to HSL
- RGB to HSL ConverterRGB to HSL
- RGBA to HSL ConverterRGBA to HSL
- CMYK to HEX ConverterCMYK to HEX
- HSL to CMYK ConverterHSL to CMYK
- HSL to HEX ConverterHSL to HEX
- HSL to HSV ConverterHSL to HSV