Color tools: converting and checking color values
The same color can be written several ways in CSS. Converting between them is easy; choosing colors people can actually read takes a little more care.
The tools
The HEX, RGB and RGBA color converter reads any common CSS color notation and writes out every equivalent, along with WCAG contrast ratios against white and black. The SVG shape and gradient generator uses the same colors for gradient fills you can export.
Which notation to use
HEX (#2f6fb0) is compact and universal for opaque colors. rgb() makes channels explicit and reads naturally when you add transparency: rgb(47 111 176 / 60%). HSL is convenient for creating tints and shades by adjusting lightness. All three describe the same sRGB color space, so converting between them is exact apart from rounding. Our article HEX, RGB and RGBA explained shows the arithmetic.
Contrast first, palette second
WCAG 2 asks for a contrast ratio of at least 4.5:1 for normal body text and 3:1 for large text and essential interface graphics. Check text colors against their actual background, not just white. For transparent colors, the visible result depends on what is underneath, so measure the blended color.
- Do not rely on color alone to convey meaning; pair it with text or an icon.
- Check both light and dark themes. A link color that passes on white can fail on a dark surface.
- Muted grey text is the most common contrast failure on otherwise well-designed sites.
Beyond sRGB
Modern CSS also supports wider-gamut spaces such as display-p3 and perceptual spaces such as oklch(). These are useful for vivid colors on capable screens and for building even-looking palettes. They cannot always be converted to HEX without clipping, so the converter here focuses on sRGB, which every browser and design tool understands.