Home › color utility › Color Code Converter
Color Code Converter
HEX to RGB & HSL Converter takes a hex colour code and returns its rgb() and hsl() equivalents with a live swatch, so you can move a colour between CSS formats without touching a design app.
How to use Color Code Converter
- Paste or type a six-digit hex colour, such as #6366f1.
- The swatch and both conversions appear immediately.
- Copy the format you need into your stylesheet.
Where Color Code Converter is useful
- Converting a brand hex value into the hsl() form for theming.
- Getting an RGB triple for a charting library that wants channels.
- Checking what a hex code actually looks like before using it.
Formats, algorithms and limits
The three hex pairs are read as red, green and blue channels, then converted to hue, saturation and lightness with the standard algorithm. Hue is reported in degrees, and saturation and lightness as percentages, which is the format CSS accepts directly. The swatch re-renders as you type, so you see each change before committing to it.
Troubleshooting and honest limits
- Leading zeros matter in hex: #0a0a0a is not the same as #aa0a00.
- HSL is easier to reason about when adjusting a theme: change lightness alone to make a lighter or darker variant.
- Keep the hash character in the input; it marks the value as hex.
Frequently asked questions
Does it support three-digit shorthand hex?
Use the full six-digit form; expanding shorthand is a one-second edit and avoids ambiguity.
Can it convert RGB or HSL back to hex?
This panel converts hex to the other two formats. A reverse conversion is a straightforward manual lookup of the CSS specification if you need it frequently.
Why do the rounded HSL values differ slightly from the original colour?
Hue, saturation and lightness are rounded to whole degrees and percentages for display, which is what CSS itself uses. The swatch shows the exact colour of the original hex value.
Can it pick colours for me?
No, but the palette panel next to it lists curated five-colour sets you can copy from.
Related tools
Page written and reviewed by the FreeConvertio engineering team on 2026-10-14. Color Code Converter runs entirely in your browser — no uploads, no account and no daily limits.