THE NUMBERS, EXPLAINED
How to use this calculator.
Converts opaque three- or six-digit HEX into sRGB channel values and HSL. No ICC profile conversion is performed.
Start with your inputs
Enter hex colour. Keep amounts in the units shown on each field. The example is a starting point, not a recommended value.
| Input | Example value |
|---|---|
| HEX colour | #ff0000 |
A worked example
With the example inputs above, rgb and hsl is rgb(255, 0, 0); hsl(0, 100%, 50%). Change the inputs to explore your own scenario.
| Result | Example answer |
|---|---|
| RGB and HSL | rgb(255, 0, 0); hsl(0, 100%, 50%) |
How this is calculated
RGB and HSL
HEXtoRGBandHSL(a)
Symbols and units
- a
- HEX colour
Use the units shown. A list keeps the order in which you enter its values. The symbol ^ means “raised to the power of”.
Calculation steps and notation
Expand three-digit HEX by repeating each digit, then read the red, green and blue bytes. Normalise to [0,1]; lightness = (maximum+minimum)/2. For non-grey colours, saturation = (maximum−minimum)/(1−abs(2 × lightness−1)); hue follows the dominant RGB channel around the six 60° colour-wheel sectors. Grey uses hue and saturation zero. HSL output is rounded to whole degrees and percentages.
Assumptions and limits
Converts opaque three- or six-digit HEX into sRGB channel values and HSL. No ICC profile conversion is performed.
Calculations use the values you enter. Blank or invalid inputs show an error instead of silently substituting zero. Results are displayed to useful precision; calculations retain the underlying numeric precision.
Questions about this tool
What does the result tell me?
RGB and HSL. The result applies to the method and inputs described above. Check the units and assumptions before using it in a decision.
Why might another calculator differ?
Differences in units, rounding, timing or model definitions can produce different answers. Compare the input definitions and the method, rather than only the final number. For this tool: Converts opaque three- or six-digit HEX into sRGB channel values and HSL. No ICC profile conversion is performed.
Are my inputs stored or sent to AI?
Calculations on this page happen in your browser. The separate AI question finder sends its submitted conversation to OpenAI; these calculator fields are not sent. Favourites and recent tool names are stored locally. A shared link contains the inputs you choose to include.
Review status
Software example and browser checks are recorded in our quality report. No external expert review is claimed. Created with coding assistance; calculations run as ordinary browser code.
Read the quality report →