Color Converter & WCAG Contrast Checker
Enter a text color and a background color to convert both between HEX, RGB and HSL and to see their WCAG 2 contrast ratio, with a live preview and a clear pass or fail for AA and AAA. If a pair fails, the tool suggests the closest text color that passes. Everything runs in your browser.
Result
WCAG contrast
Large text sample
The quick brown fox jumps over the lazy dog.
| Requirement | Needed | Result |
|---|---|---|
| AA, normal text | 4.5 : 1 | |
| AA, large text (24 px, or 19 px bold) | 3 : 1 | |
| AAA, normal text | 7 : 1 | |
| AAA, large text | 4.5 : 1 | |
| AA, interface parts and graphics | 3 : 1 |
A translucent color is blended with the background (a translucent background is blended with white) before the ratio is measured.
A text color that passes
Color formats
| Format | Value | Copy |
|---|
Examples
Reference ratios you can check against other tools (text on white):
| Text color | Contrast on white | AA normal text |
|---|---|---|
#000000 | 21.00 : 1 | Pass |
#595959 | 7.00 : 1 | Pass |
#767676 | 4.54 : 1 | Pass |
#777777 | 4.48 : 1 | Fail |
#949494 | 3.03 : 1 | Fail |
Formula & Methodology
Each channel is converted from sRGB to linear light, and relative luminance is L = 0.2126 R + 0.7152 G + 0.0722 B. The contrast ratio is (L1 + 0.05) รท (L2 + 0.05) with L1 the lighter color, from 1 : 1 (identical) to 21 : 1 (black on white). WCAG 2 asks for 4.5 : 1 for normal text and 3 : 1 for large text at level AA, and 7 : 1 and 4.5 : 1 at level AAA. Interface components and graphics need 3 : 1.
L = 0.2126 R + 0.7152 G + 0.0722 BCR = (L1 + 0.05) รท (L2 + 0.05)Ratios are shown to two decimals, but pass or fail uses the exact value: 4.499 : 1 never counts as 4.5 : 1.
Notes and limitations
- This is the WCAG 2.x contrast method. It does not predict readability for every person, and newer methods such as APCA are not covered.
- Large text means at least 24 CSS pixels, or 18.66 pixels (14 pt) in bold.
- Contrast depends on the final rendering: anti-aliasing, font weight, images behind text and gradients are not measured.
- Supported formats: HEX (3, 4, 6, 8 digits), rgb()/rgba(), hsl()/hsla() and a few basic color names. Other CSS color spaces (lab, oklch, color()) are not supported.
- A translucent text color is measured after blending with the background; a translucent background is blended with white.
How to Use
- Type the text color and the background color, or use the color pickers.
- Read the converted values and copy the format you need.
- Check the contrast ratio and the pass or fail result for each requirement.
- If the pair fails, try the suggested text color or adjust a color.
Frequently Asked Questions
What contrast ratio do I need?
For WCAG 2 level AA, normal text needs at least 4.5 : 1 and large text at least 3 : 1. Level AAA asks for 7 : 1 and 4.5 : 1. Interface controls and meaningful graphics need 3 : 1 against their surroundings.
What counts as large text?
Text of at least 24 CSS pixels, or at least about 18.7 pixels (14 point) when it is bold. Everything smaller is normal text.
Which color formats can I enter?
HEX with 3, 4, 6 or 8 digits, rgb() and rgba(), hsl() and hsla(), and a set of basic color names such as red, navy or rebeccapurple. Both comma and space syntax work.
Why does 4.5 : 1 sometimes show as failing?
The ratio shown is cut to two decimals, but the test uses the exact value. A ratio of 4.4999 would be written 4.49, because it does not meet the 4.5 : 1 requirement.
Is anything sent to a server?
No. Conversions and contrast checks run in your browser and nothing you enter is uploaded or sent to analytics.
Last updated: