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.
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.
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
Four steps to check your inputs and results
- 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.
- Enter HEX or RGB color in the stated format. Baseline values are for reproduction.
- 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.
- 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.
From question to result