Technical utilities

Color Code Converter

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.

  • Explicit formulas and worked examples
  • Check your inputs, then calculate
  • Data is calculated in this browser only

Check the stated input format, calculation convention and limits before using the result.

Your inputs

Local calculation

Check the example inputs, then calculate. Your values stay in this browser.

Input supports #RGB, #RRGGBB and rgb(r,g,b); HSL input and alpha are not yet supported.

Calculation notes

Understand the Color Code Converter

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.

Formula and logic

What is the formula for the Color Code Converter?

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.

Worked example

How can I reproduce the Color Code Converter 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.

How to read the result

How should I interpret the Color Code Converter result?

  • 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.
Limits and assumptions

What limits apply to the Color Code Converter?

  • 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.

Content and calculation reviewed:

Understand the calculation

How to use it and the math behind it

Read the complete explanation

Four steps to check your inputs and results

  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.

Color Code Converter: calculation relationships

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

The detailed guide adds variable definitions, a reproducible example, a practice question and model limitations.

From question to result

Continue with a related question

Explore all Technical utilities tools and guides