Convert colors between HEX, RGB and HSL, and check they can be read
A brand guide gives a color as a HEX code, a designer sends RGB, a slide program wants HSL, and the printer asks for CMYK. This tool takes a color in any of those forms and shows all the others, with a scale of lighter and darker versions to build a palette from. Next to it, a contrast checker tells you whether text in one color can be read on a background of another, using the WCAG 2 accessibility rules that many organisations and public bodies are required to follow, and suggests the nearest color that passes if yours does not.
How to use it
- Type a color in any format, such as #24453a, 24453a, rgb(36, 69, 58), hsl(160 31% 21%) or a name like teal, or click the swatch to pick one.
- Copy the format you need from the list. Click a tint or shade to switch to it.
- To check contrast, type a text color and a background color. The sample shows them together, and the ratio is marked pass or fail for normal and large text.
- If it fails, the tool suggests a darker or lighter text color in the same hue that passes AA; click to use it.
The contrast rules
Contrast ratio compares how light two colors are, from 1:1 (the same) to 21:1 (black on white). WCAG 2 level AA asks for at least 4.5:1 for normal text and 3:1 for large text (24 pixels, or about 19 pixels if bold). Level AAA asks for 7:1 and 4.5:1. Icons, chart lines and the edges of form fields need 3:1 against what is next to them. The ratio here uses the exact formula from the standard, based on relative luminance, and is rounded down to two decimals, so a color shown as 4.49:1 really does fail.
Good to know
- CMYK here is a simple conversion without a printer profile. For accurate print colors, ask your printer for their profile or a Pantone match.
- Transparent colors: the alpha part of an 8-digit HEX or rgba() value is shown, but the contrast check treats colors as solid; check semi-transparent text against the color it ends up as.
- Contrast is not everything. Font weight, size and spacing matter too, and color should never be the only way to tell things apart.
- Nothing is sent or stored. Everything runs in this page.
How this tool was tested
Before publishing, I ran 30 automated checks on the finished page in Microsoft Edge, which is built on Chromium like Chrome. Last full run: 15 November 2026.
- Known colors: #24453a is rgb(36, 69, 58), hsl(160, 31%, 21%), HSV 160, 48%, 27% and CMYK 48, 0, 16, 73; red, green and blue in HSL; names such as teal and rebeccapurple; short and 8-digit HEX; rgb() with spaces, slashes and percentages.
- 3,000 random colors: HEX round-trips exactly, and HSL comes back within 5 steps out of 255, the rounding any whole-number HSL value has.
- Contrast ratios match published values: black on white 21:1, #767676 on white 4.54:1 (just passing), #777777 4.47:1 (failing, and shown rounded down so it does not look like a pass), blue on white 8.59:1. For 400 random pairs, the suggested fix always reaches 4.5:1 when any color could.
- Using the tool: typing each format, a bad color, tints and shades, the pass and fail labels, using the suggested fix, and swapping.
What the tests did not cover: Safari and Firefox were not tested. CMYK is a simple conversion without a printer profile, and the contrast check treats colors as solid. Something not working? Tell me on the contact page.
FAQ
How do I convert HEX to RGB?
Split the six digits into three pairs and read each pair as a number from 0 to 255: #24453a is 0x24 = 36, 0x45 = 69, 0x3a = 58, so rgb(36, 69, 58).
Is grey text on white accessible?
#767676 on white is 4.54:1, just over AA for normal text. Anything lighter fails.
What is the difference between HSL and HSV?
Both describe hue, then how strong the color is. In HSL, 100% lightness is always white; in HSV, 100% value is the brightest form of the color. Design programs differ in which they use.