CSS Color Converter
Convert any CSS color between HEX, RGB and HSL with a live preview and contrast ratios against white and black text.
Input
Conversions
Why color formats matter
The same color can be written several ways in CSS. Design tools usually hand over HEX codes. RGB is handy when you need transparency with rgb() or rgba(). HSL describes a color by hue, saturation and lightness, which makes it easy to build lighter and darker shades of a brand color. Converting cleanly between them keeps your design tokens consistent.
How to use the converter
Paste a HEX, RGB or HSL value, or pick a color with the color picker. The tool shows the color in all three formats with a preview, and you can copy any of them with one click. It also shows the contrast ratio against white and black text, using the WCAG 2 formula, so you can see at a glance which text color is readable on it.
Reading the contrast badges
- AAA: a ratio of 7:1 or more, the strictest level for normal text.
- AA: 4.5:1 or more, the usual target for body text.
- AA large text only: 3:1 or more, fine for large headings but not body text.
Frequently asked questions
Should I use HEX or HSL in my CSS?
Both work in every modern browser. HEX is compact for fixed values. HSL is easier when you want to adjust lightness or saturation, for example to create hover states or a palette of tints.
Why does converting back and forth change a value slightly?
HSL values are rounded to whole numbers here, so a round trip can shift a channel by one step. The difference is not visible, but use the HEX or RGB value as your source of truth.
Does the tool support transparency?
It reads rgba() and hsla() values but ignores the alpha channel, since contrast and HEX conversion here are for solid colors.

