Color converter: HEX, RGB and HSL, with a contrast checker
Type or pick a colour to get its HEX, RGB and HSL values, then check whether your text and background colours have enough contrast to be readable.
Runs in your browser. Nothing you enter is sent to EpiFive.
Contrast checker (WCAG)
| Normal text, AA | ✓ Pass |
|---|---|
| Large text, AA | ✓ Pass |
| Normal text, AAA | ✗ Fail |
| Large text, AAA | ✓ Pass |
| UI components and graphics, AA | ✓ Pass |
How to use it
- Type a colour in the HEX, RGB or HSL box, or use the colour picker. The other boxes update as you type.
- Copy the format you need with its Copy button.
- In the contrast checker, enter a text colour and a background colour (any format), or use the buttons to bring in the colour above. Check the preview and the pass or fail for each WCAG level.
Formats it understands
- HEX:
#2c7c68,#2c7,#2c7c6880(with alpha), with or without the #. - RGB:
rgb(44, 124, 104),rgba(44, 124, 104, 0.5),rgb(44 124 104 / 50%). - HSL:
hsl(165, 48%, 33%),hsla(165, 48%, 33%, 0.5).
Related tools
- CSS gradient generator: Design linear, radial and conic CSS gradients with colour stops and copy the CSS.
- Favicon generator: Make favicon.ico and PNG app icons from an image, text or emoji, with the HTML to paste.
- Number base converter: Binary, octal, decimal, hex and any base from 2 to 36, any size, with two’s complement at 8 to 128 bits.
- Meta tag generator: Title, description, canonical, robots, Open Graph and Twitter tags with a live Google preview.
Questions people ask
How do I convert HEX to RGB?
Split the six hex digits into three pairs and convert each pair from base 16 to a number from 0 to 255. #2C7C68 becomes 2C = 44, 7C = 124 and 68 = 104, so rgb(44, 124, 104). Type a HEX code above and the RGB and HSL values update straight away.
What contrast ratio does WCAG require?
WCAG 2 level AA needs at least 4.5:1 for normal text and 3:1 for large text (24 px, or about 18.5 px bold) and for icons, borders and other UI parts. Level AAA needs 7:1 for normal text and 4.5:1 for large text. The ratio runs from 1:1 (no contrast) to 21:1 (black on white).
Why does #767676 matter?
#767676 is the lightest grey that passes AA on a white background, at 4.54:1. Anything lighter, such as #777777 (4.47:1), fails for normal text. The ratio is truncated, not rounded, so a colour that is 4.49:1 is never shown as a pass.
What do the 8-digit HEX and the alpha value mean?
The last two digits of an 8-digit HEX code, or the fourth value in rgba() and hsla(), set transparency: FF or 1 is solid, 00 or 0 is fully clear. For contrast, a transparent text colour is blended onto the background first, as a screen would show it.
When should I use HSL instead of HEX?
HSL (hue, saturation, lightness) is easier to adjust by hand: keep the hue and change the lightness to get lighter and darker shades of the same colour for hover states and themes. HEX is shorter and is what design tools usually export. Browsers treat them the same.