Check contrast before someone else does
LOCALContrast is the easiest part of accessibility to measure, and one of the easiest to get wrong. WCAG 2.2 asks for 4.5:1 between normal text and its background at level AA, 3:1 for large text, and 7:1 or 4.5:1 at the enhanced AAA level. Those figures are not brightness guesses: they come from the relative luminance of linearized sRGB channels, which is why a light grey can look fine on screen and still fail. This checker accepts #RGB and #RRGGBB, prints the exact ratio, marks all four thresholds and renders your pair at 24 px and 14 px. When the pair fails, it also finds the closest shade of the foreground that reaches 4.5:1. Everything runs in this tab; no color is uploaded or stored.
How it works
- 01
Enter the two colors
Paste a hex value into the foreground or background field, with or without the leading #. Three-digit shorthand is expanded the way CSS does it, so #fff becomes #FFFFFF, and letter case does not matter. Each field also has a native color picker, and choosing a swatch rewrites the text field so the two stay in sync. If a value cannot be parsed, the field shows an error and the ratio area stays empty instead of guessing.
- 02
Read the ratio and the four checks
The big number is the contrast ratio, calculated as (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter relative luminance. It always falls between 1:1 and 21:1. Below it, the four WCAG text thresholds are listed separately: AA normal at 4.5:1, AA large at 3:1, AAA normal at 7:1 and AAA large at 4.5:1. A pair can pass AA and fail AAA, or pass for large text but fail for body copy; the list makes that difference visible instead of reducing everything to one verdict.
- 03
Compare the live preview
The preview draws the same sentence twice on your background color, once at 24 px and once at 14 px. Large text at AA only needs 3:1, so a pair that looks weak in the small line may still be acceptable for a headline. Remember that the threshold depends on point size and weight, not on the two sample sizes: 18 pt (24 px) regular or 14 pt (about 18.66 px) bold counts as large under WCAG. Use the preview as a sanity check, not as a substitute for the numbers.
- 04
Apply the suggestion or copy the ratio
When the pair is below 4.5:1, the suggestion panel shows the nearest foreground shade that reaches the target against the current background. Applying it updates the foreground field, so you can keep editing from there. The copy button puts the ratio on the clipboard as plain text such as 8.59:1, ready for a ticket, a style guide or a client email. Nothing is saved, so reloading returns to the example pair.
When to use it
Design tokens and brand palettes
Most design systems define a small set of text colors: primary, secondary, muted and inverse. Checking each token against the surfaces it will actually sit on catches problems before they spread through a product. A muted grey that passes on white may fail on a warm off-white card, and an inverse label that works on the brand blue may fail on a lighter hover state. Testing the real pairs, rather than one text color against one background, is the point.
Accessibility reviews and client handoff
When you audit a page, record the measured ratio next to the WCAG criterion it belongs to. A note such as “body text #595959 on #FFFFFF = 7.0:1, passes AAA normal” is far more useful than “contrast looks okay”. The four checks give you the exact wording for AA and AAA, and the copy button keeps the number accurate when it travels into a report. This is evidence, not a promise that the whole page is accessible.
Landing pages and buttons
Marketing pages often place white text on a brand color that was chosen for a logo, not for reading. Test the actual text and background values, including hover and disabled states. Text inside a button still needs 4.5:1 for normal size; the 3:1 non-text rule for component boundaries is a separate requirement that this checker does not evaluate. If the brand color fails, the suggestion gives you a nearby shade that keeps the look while making the label readable.
Teaching and quick spot checks
Because the formula is shown and the preview is immediate, the page works well in a classroom or a design review. Change one channel at a time and watch how slowly the ratio moves: contrast is dominated by luminance, so darkening a saturated red helps less than expected, while a small drop in a light blue can hurt a lot. The tool is a measuring instrument, not an auto-fixer; the final judgement still belongs to a person looking at the page.
Questions
What ratio do I need for WCAG AA and AAA?
For normal body text, AA requires at least 4.5:1 and AAA requires 7:1. For large text, AA requires 3:1 and AAA requires 4.5:1. These are minimums for text contrast under WCAG 2.2 success criteria 1.4.3 and 1.4.6; a higher ratio is always allowed. The thresholds apply to text, not to every visual element. Interface components, focus indicators and meaningful graphics are covered by the separate non-text contrast rule at 3:1, which this page does not check.
What counts as large text?
WCAG defines large text as 18 point regular or 14 point bold. In CSS pixels that is roughly 24 px regular or 18.66 px bold, assuming the usual 96 dpi reference. Weight matters: 18 px bold can qualify, while 18 px regular does not. The preview uses 24 px and 14 px only to show the difference; it does not detect the weight or size of your real interface. Decide which category your text belongs to, then read the matching check.
Why does 4.49:1 fail when it looks like 4.5:1?
WCAG compares the calculated ratio with the threshold; there is no rounding up. 4.499 is below 4.5 and fails AA for normal text, even though a two-decimal display could make it look like a pass. This checker truncates the displayed value instead of rounding it, so you never see 4.50 next to a fail. If you need a safety margin for different rendering engines, aim for 4.6:1 or higher rather than sitting exactly on the boundary.
How is the contrast ratio calculated?
Each sRGB channel is divided by 255 and linearized: values up to 0.04045 are divided by 12.92, larger values use ((c + 0.055) / 1.055) ^ 2.4. Relative luminance is 0.2126 R + 0.7152 G + 0.0722 B on those linear values. The ratio is (L1 + 0.05) / (L2 + 0.05), with L1 the lighter of the two. This is why green contributes much more than blue to perceived lightness, and why a saturated blue can have a surprisingly low luminance.
Why is black on white 21:1 rather than infinite?
The +0.05 terms in the formula keep the result finite and model the ambient light reflected from the display. White has a relative luminance of 1 and black has 0, so the ratio becomes (1 + 0.05) / (0 + 0.05) = 21. No pair of opaque colors can exceed 21:1, and identical colors give 1:1 because both luminances are the same.
How does the suggested passing color work?
The tool keeps the hue as far as possible and moves the foreground in a straight line toward black or toward white, whichever direction needs the smaller change. A binary search finds the first point where the ratio reaches 4.5:1 against your background, and the result is shown with its own ratio. Because the path is a simple mix, the suggestion can shift saturation and may not match a hand-tuned palette. Treat it as a starting point: apply it, look at the preview and adjust if the brand needs a different balance.
Can it check text placed over an image or a gradient?
Not reliably. The checker compares two solid colors, so for a photo, a video or a gradient you have to test the worst-case area behind the text. If the lightest or darkest pixel under a label still fails, the label fails at that point, even if most of the image looks fine. A common fix is a semi-opaque overlay or a solid caption bar; test the effective color where text and backdrop meet, and remember that a translucent overlay changes with whatever is behind it.
Which hex formats are accepted?
Three-digit and six-digit hexadecimal, with or without a leading #, in either case: #fff, fff, #8C8C8C and 8c8c8c all work. Shorthand is expanded by doubling each digit, so #abc becomes #AABBCC. This checker does not accept named colors, rgb() or hsl() notation, eight-digit hex with alpha, or values with spaces inside. Alpha is deliberately excluded because a translucent color has no single contrast ratio until you know what is behind it.
Is anything uploaded, and is this a full accessibility audit?
Nothing is uploaded or stored. Parsing and calculation are plain JavaScript in the current tab, with no account, network request or database. The tool is also not a full audit: it does not check non-text contrast, focus visibility, color-only meaning, alt text, reading order or whether text over media is stable. Use it to settle one specific question, the ratio between two colors, and combine it with keyboard testing, screen reader checks and a review against the rest of WCAG.