Technical utilities · Calculation notebook

Color Code Converter: HEX, RGB & HSL Values: Worked Examples

Learn the inputs, formula and worked example behind the Color Code Converter, including color code converter: calculation relationships, result interpretation, assumptions and sources.

Open calculator By Toolify · Updated

Purpose and steps

Color Code Converter validates hex or rgb color before applying the displayed equation. Input supports #RGB, #RRGGBB and rgb(r,g,b); HSL input and alpha are not yet supported.

  1. Convert a three- or six-digit HEX color or integer RGB color into HEX, RGB and HSL representations. The result describes an sRGB color, not print color management.
  2. Enter HEX or RGB color in the stated format. Baseline values are for reproduction.
  3. Check the output unit and convention: Read hex with its stated unit and convention. The default example and the independent worked scenario use different inputs, so compare the assumptions before comparing the numbers.
  4. Change one input and compare the result. Input supports #RGB, #RRGGBB and rgb(r,g,b); HSL input and alpha are not yet supported. Color spaces, display calibration and CMYK are outside this tool.

Input reference and units

These values reproduce the model’s demonstration. Replace them with your own records or measurements; they are not recommended targets.

On a small screen, swipe the table horizontally to see all columns.

Parameters used by this calculator
ParameterDemonstration valueHow to enter it
HEX or RGB color#0080FF Enter hex or rgb color without adding a unit suffix. Scope: Input supports #RGB, #RRGGBB and rgb(r,g,b); HSL input and alpha are not yet supported.

Model-specific method

How this calculator produces its result

Color Code Converter: hex = base16(R,G,B); HSL = hue, saturation and lightness from normalized RGB. Input definitions: value = HEX or RGB color. Use the selected convention throughout the calculation.

Color Code Converter: calculation relationships

Convert a three- or six-digit HEX color or integer RGB color into HEX, RGB and HSL representations. The result describes an sRGB color, not print color management. Input supports #RGB, #RRGGBB and rgb(r,g,b); HSL input and alpha are not yet supported. Color spaces, display calibration and CMYK are outside this tool.

Hex pairs encode RGB channel integers from 0 to 255. #FF8000 becomes rgb(255,128,0); short #f80 instead expands to #FF8800, not #FF8000. HSL describes hue, saturation and lightness for the same channels, with hue undefined for a neutral gray and shown as zero by convention. Alpha and color-profile conversion are outside this parser.

hex = base16(R,G,B); HSL = hue, saturation and lightness from normalized RGB
  • value: HEX or RGB color. Enter hex or rgb color without adding a unit suffix. Scope: Input supports #RGB, #RRGGBB and rgb(r,g,b); HSL input and alpha are not yet supported.
  • Result units: stated beside each output
  • Calculation relationship: hex = base16(R,G,B); HSL = hue, saturation and lightness from normalized RGB
  • Supported domain: see the limits below

Worked example

Color Code Converter baseline input: HEX or RGB color: #0080FF. Output: HEX = #0080FF; RGB = rgb(0, 128, 255); HSL = hsl(209.88, 100.00%, 50.00%). Substitute these values into the displayed equation to reproduce the result.

Reproduce the default scenario

This reproduces the default inputs in the reference table above; it is not an additional independent example. Displayed rounding may differ from intermediate precision.

HEX
#0080FF
RGB
rgb(0, 128, 255)
HSL
hsl(209.88, 100.00%, 50.00%)

Reading results without overstating them

  • Read hex with its stated unit and convention. The default example and the independent worked scenario use different inputs, so compare the assumptions before comparing the numbers.
  • Change one input at a time and use the equation to explain the result; do not mix unit, grade-scale, time-zone or rounding conventions across comparisons.

Assumptions and exclusions

  • Input supports #RGB, #RRGGBB and rgb(r,g,b); HSL input and alpha are not yet supported.
  • Color spaces, display calibration and CMYK are outside this tool.
Test a changed assumption in the calculator

Sources and content notes

Toolify describes the implemented algorithm and its assumptions. Sources below support the topic or applicable rules; they do not endorse this calculator. Examples are illustrative, and published rules take precedence over simplified estimates.

Report a formula, example or translation issue through our contact page. Include the tool name, inputs and expected result so it can be reproduced. Contact Toolify

From question to result

Continue with a related question

Explore all Technical utilities tools and guides