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

  1. Paste or type a six-digit hex colour, such as #6366f1.
  2. The swatch and both conversions appear immediately.
  3. Copy the format you need into your stylesheet.

Where Color Code Converter is useful

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

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

Harmonious Palette Builder

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.