Technical utilities

Color Code Converter

Convert HEX, RGB or HSL notation into all three formats. HSL hue wraps around 360 degrees; saturation and lightness are percentages, and RGB output rounds to 8-bit channels.

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

Accepts #RGB, #RRGGBB, integer rgb(r,g,b), and comma-separated hsl(h,s%,l%); HSL supports signed degree hues.

Calculation notes

Understand the Color Code Converter

Choose the right record before calculating

Use opaque HEX, RGB or supported HSL notation. Short HEX repeats each digit into a full pair. HSL is another representation of the same sRGB channels, not a contrast assessment. Check text and background accessibility separately after conversion.

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 HEX, RGB or HSL notation into all three formats. HSL hue wraps around 360 degrees; saturation and lightness are percentages, and RGB output rounds to 8-bit channels.
  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. Accepts #RGB, #RRGGBB, integer rgb(r,g,b), and comma-separated hsl(h,s%,l%); HSL supports signed degree hues. HSL conversion rounds to 8-bit sRGB channels; alpha, CSS color profiles, percent RGB and modern space/slash syntax are outside this parser.

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. HSL input is also accepted: hsl(120,100%,50%) becomes #00FF00. Hue is wrapped by 360 degrees; saturation and lightness must stay in 0–100%, and RGB channels are rounded to integers.

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.

Questions before you calculate

Does #abc equal #aabbcc?

Yes. Each short-HEX digit expands by repetition.

Can I enter HSL?

Yes within the supported opaque HSL syntax and bounds.

Is HSL lightness WCAG luminance?

No. Contrast requires a different linearized-sRGB calculation.

Why does gray show a hue number?

At zero saturation hue is indeterminate; the formatter supplies a convention.

Does this produce a print color match?

No. Printing profiles and ink models are separate from opaque sRGB notation.

Take the calculator with you

Embed this calculator

Formula sheet (English PDF)

Use the iframe for a fixed-height embed, or the JavaScript helper for automatic height. Calculations stay inside the frame; inputs and results are never sent to your site.

The optional Toolify source link uses nofollow. The calculator keeps working if you remove the link. No analytics or advertising scripts load in the widget. Use offline tools

From question to result

Continue with a related question

Explore all Technical utilities tools and guides