What is a Contrast Checker?
A contrast checker measures the difference in luminance between a foreground and a background colour and returns a ratio between 1:1 (the two colours are identical) and 21:1 (pure black on pure white). WCAG 2.2 turns that number into a conformance test: 4.5:1 for normal text at level AA, 3:1 for large text and for non-text interface elements, and 7:1 for normal text at level AAA.
The calculation follows the WCAG definition exactly. Each sRGB channel is divided by 255 and linearised — c / 12.92 below 0.03928, otherwise ((c + 0.055) / 1.055)²·⁴ — then weighted 0.2126 red, 0.7152 green and 0.0722 blue to give relative luminance. The ratio is (L₁ + 0.05) / (L₂ + 0.05) with the lighter colour first. Green carries most of the perceived brightness and blue almost none, which is why a blue-on-black pair can look legible on screen and still fail.
"Large text" has a precise definition: 24 px and above, or 18.66 px and above when bold. That is roughly 18 pt and 14 pt — the sizes at which thinner strokes stop being a legibility problem, which is why the threshold drops to 3:1.
How to check the contrast between two colours
- Enter the foreground and background colours, either as hex values (#374151, or the three-digit #fff shorthand) or with the colour pickers.
- Read the ratio, shown to two decimal places. Above 4.5:1 is the practical target for body copy.
- Read the conformance table, which marks each WCAG requirement as pass or fail against this specific pair rather than in the abstract.
- Look at the live preview. It renders a heading and body copy in your exact pairing, which is the fastest way to catch a pair that technically passes but still reads badly.
- Use Swap colours when it is unclear which of the two is the darker one, and the presets to compare against a known-good grey, dark-mode pair or your brand colour.
Contrast Checker limits and rules
| Item | Limit |
|---|---|
| AA, normal text | 4.5:1 minimum |
| AA, large text | 3:1 minimum — 24 px+, or 18.66 px+ bold |
| AAA, normal text | 7:1 minimum |
| AAA, large text | 4.5:1 minimum |
| Non-text and UI components | 3:1 against adjacent colours (WCAG 1.4.11) |
| Focus indicators | 3:1 for the indicator against the surrounding colours (WCAG 2.4.11, added in 2.2) |
| Theoretical maximum | 21:1 — pure black #000000 on pure white #ffffff |
| Lowest grey that passes on white | #767676 at about 4.54:1 |
| Not covered | APCA (a WCAG 3 draft), colour-blindness simulation and OS forced-colours modes |
When to use it
- Choosing a muted grey for secondary text, which is the single most common contrast failure on marketing sites — the ratio is worth checking before the colour reaches a design token.
- Auditing dark mode, where a light-theme palette gets inverted and the mid-tones collide.
- Checking buttons, form placeholders, disabled states and focus rings, since non-text contrast has its own 3:1 rule that text checks do not cover.
- Responding to an accessibility audit or an automated Lighthouse report by finding the exact failing pair and the smallest change that fixes it.
- Picking a brand accent that still works as text, rather than discovering after launch that the brand colour only passes at 24 px.
Is it private?
Everything runs inside your browser. Your text and files are never uploaded, never stored and never seen by anyone else — including me. You can use the tool with the network tab open and watch no request leave the page. Closing the tab erases the input.
Frequently asked questions
4.5:1 for normal-sized text, 3:1 for large text (24 px or larger, or 18.66 px bold) and 3:1 for non-text UI such as icons, borders and focus rings. 7:1 is the AAA level for normal text if you are aiming for enhanced conformance.
It measures about 4.54:1 against #ffffff — the lightest neutral grey that still clears the 4.5:1 AA threshold. One step lighter, #777777, drops just below it, which is why that specific value shows up in accessibility guidance.
Yes. Placeholder text is text, so WCAG 1.4.3 applies to it. Exceptions exist for text that is purely decorative or part of an inactive control, but a greyed-out placeholder inside a live input still needs 4.5:1.
No. The ratio is a floor, not a design goal — a pair can pass at 4.6:1 and still look washed out, particularly in small sizes or with a thin font weight. The preview below the ratio is there to judge that, and APCA is the newer perceptual model being drafted for WCAG 3.
No. Contrast ratio is luminance-only and says nothing about hue discrimination, which is a separate WCAG 1.4.1 requirement — never rely on colour alone to convey meaning, and check hue-dependent pairs with a colour-blindness simulator.
Related tools
Written and maintained by Md. Nur Hossain Repon.