Skip to content
Accessibility
Theme
Text size
High contrast
Limit animations
Readable fontAtkinson Hyperlegible
Increased text spacing
Underline links
Always show focus

Runs in your browser — nothing you paste is uploaded.

Color Converter

Convert a color between HEX, RGB and HSL. Paste any format — get the others plus a live swatch. Runs in your browser.

Accepts hex, rgb() or hsl(). Use the swatch to pick.


    

What it does

Enter a color in HEX (#2271b1 or the short form #abc), RGB (rgb(34, 113, 177)) or HSL (hsl(205, 68%, 41%)) and the tool returns all three formats at once, with a live swatch so you can see the result. The native color picker beside the field works the same way — picking a color fills the text box and converts it.

How it works

Whatever you paste is parsed into red, green and blue channels first. HEX is read directly; HSL is converted to RGB with the standard chroma formula. From that RGB triple the tool derives the HSL values. So every format you see is computed from the same underlying color. RGB channels are whole numbers from 0 to 255, HSL hue is a whole number of degrees and saturation and lightness are whole percentages.

Gotchas

  • Alpha is ignored. rgba(0,0,0,0.5) is read as rgb(0,0,0) and no transparency is carried through.
  • Because HSL is rounded to integers, converting HEX → HSL → HEX can shift by one step per channel. This is rounding, not a bug, and is not visible to the eye.
  • Out-of-range values are clamped: an RGB channel above 255 becomes 255.

Worked example

Paste hsl(205, 68%, 41%) and you get #2271b1 and rgb(34, 113, 177) back — handy when a design tool gives you HSL but your CSS variables are hex. To check whether a foreground and background pair meets WCAG contrast, try the Contrast Checker; to turn a color name into a URL-safe string use the Slug tool.

Privacy

Conversion is local; nothing is uploaded.

Frequently asked questions

Does it support alpha or opacity?

No. The converter reads the red, green and blue channels and ignores any alpha value, so rgba(0, 0, 0, 0.5) is treated as rgb(0, 0, 0). It converts only between opaque HEX, RGB and HSL.

Why do the numbers shift slightly when I round-trip a color?

HSL values are rounded to whole degrees and whole percentages, and RGB channels are whole numbers. Converting HEX to HSL and back can land on an adjacent integer because several nearby colors round to the same HSL. The difference is at most one step per channel and is not visible.

What input formats are accepted?

Three-digit and six-digit hex (with or without the leading hash, such as #abc or 2271b1), rgb()/rgba(), and hsl()/hsla(). Spaces or commas between values both work. Anything else shows an unrecognised-color message.

Related tools