Color Contrast Checker
Developer Tools · Added 18 August 2026
Enter a text colour and a background and get the WCAG contrast ratio, with a clear pass or fail against every threshold that applies — body text, large text and interface components. Translucent colours are composited before measuring, and when a pair fails, the nearest passing shades in both directions are offered.
Contrast
Contrast ratio
4.54:1
Passes AA for body text. AAA needs 7:1.
Normal body text at 16px — this is what 4.5:1 is measured against.
Large text at 24px bold
- Body text (AA)
- Pass
- Body text (AAA)
- Fail
- Large text (AA)
- Pass
- Large text (AAA)
- Pass
- UI components
- Pass
- Effective text colour
- #767676
Needs 4.5:1
Needs 7:1
18.66px bold or 24px
Needs 4.5:1
SC 1.4.11 — needs 3:1
Colour values
- Text — hex
- #767676
- Text — rgb
- rgb(118, 118, 118)
- Text — hsl
- hsl(0, 0%, 46%)
- Background — hex
- #ffffff
- Background — rgb
- rgb(255, 255, 255)
The ratio is the WCAG 2.1 formula, which is what accessibility audits and procurement checks are written against. It is a relative-luminance calculation, not a perceptual model — it is known to be harsh on light text over mid-tone backgrounds and generous the other way. APCA, the replacement being developed for WCAG 3, will eventually change the numbers, but it is not a conformance requirement anywhere yet.
How to use the color contrast checker
- 1Enter the text colour as hex, rgb(), hsl() or a CSS colour name — or use the colour picker.
- 2Do the same for the background.
- 3Read the ratio and the pass or fail against each WCAG threshold.
- 4Check the live sample, which shows body text, large text and a reversed button at those colours.
- 5If the pair fails, copy one of the suggested shades — same hue, adjusted lightness.
Examples
The classic borderline grey
- Input
- #767676 text on #ffffff
- Result
- 4.54:1 — passes AA for body text by a hair, fails AAA
#767676 is the lightest pure grey that passes AA on white. Anything lighter fails.
A translucent overlay
- Input
- rgba(0, 0, 0, 0.5) on #ffffff
- Result
- Composited to #808080 first — 3.95:1, which fails AA for body text
A failing brand colour
- Input
- #4a9eff text on #ffffff
- Result
- 2.35:1 — fails everything, with a darker #0a5fbf suggested at 4.5:1
About the color contrast checker
How the ratio is calculated
Each colour channel is normalised to 0–1 and linearised — undoing the gamma encoding that sRGB applies — then weighted 0.2126 red, 0.7152 green, 0.0722 blue to give relative luminance. Those weights reflect how much each primary contributes to perceived brightness, which is why green dominates and blue barely registers.
The ratio is then (lighter + 0.05) ÷ (darker + 0.05). The 0.05 represents ambient light reflecting off the screen, and it is what caps the scale: pure black on pure white gives 21:1, and nothing can exceed it.
Where contrast failures actually come from
Rarely from body text, which most designers check. The usual sources are elsewhere: placeholder text, which is grey by convention and almost always fails; disabled states, which are exempt from the requirement but still need to be perceivable; text over a photograph, where the contrast varies across the image; and brand colours used for links, which were chosen for a logo rather than for reading.
Light-on-dark is its own trap. A colour that passes comfortably as dark text on white frequently fails when the same pair is inverted for dark mode, because the formula is not symmetric. Every pair needs checking in both themes rather than assuming one implies the other.
Fixing a failure without redesigning
The suggestions here adjust lightness while holding hue and saturation, which usually keeps a colour recognisably itself. That is what makes them usable as an actual fix rather than a different palette — a brand blue darkened until it passes is still the brand blue.
Where that is not enough, the other levers are weight and size. Making text bolder raises its perceived contrast without changing the colour, and pushing a heading past 24px moves it to the 3:1 threshold. What does not work is a text shadow: it makes text look more legible in a screenshot and does nothing for the measured ratio or for a user with low vision.
Frequently asked questions
What counts as large text?
What is the 3:1 rule for interface components?
Why does the ratio change when I use a transparent colour?
Does the ratio account for colour blindness?
Is the WCAG formula accurate?
Which conformance level should I aim for?
Related tools
CSS Unit Converter
Converters
Convert px, rem, em, pt, %, vw and vh against a root font size you set.
Meta Tag Analyzer
Developer Tools
Audit a page's title, description and social tags from its HTML, with card previews.
Hash Generator
Developer Tools
Generate SHA-256, SHA-384, SHA-512 or SHA-1 digests of text or a file, and verify a checksum.