induwara.lk
induwara.lkDeveloper · Accessibility

Color Contrast Checker — WCAG AA & AAA

Paste a text color and a background color to see the exact contrast ratio and whether it passes WCAG 2.1 AA and AAA — with a live preview and one-click fixes. No signup, runs entirely in your browser.

By Induwara AshinsanaUpdated Jun 8, 2026
Check color contrast
WCAG 2.1· AA & AAA
Weight
Try a pairing
Contrast ratio
10.36 : 1

Passes AA and AAA for normal text (10.36 : 1). This pairing is fully accessible.

Live previewThe quick brown fox jumps over the lazy dog.1234567890 — sample body text at the selected size.

WCAG conformance

AA — Normal text
needs 4.5:1
AA — Large text
needs 3.0:1
AAA — Normal text
needs 7.0:1
AAA — Large text
needs 4.5:1
UI & graphics
needs 3.0:1
Thresholds and formulas from· runs entirely in your browser — nothing is uploaded.

How it works

The checker follows the contrast algorithm published by the World Wide Web Consortium in WCAG 2.1. It is the same maths used by accessibility auditors, browser dev-tools, and design systems, and it is the standard referenced by the EU Accessibility Act, US Section 508, and the ADA. Four steps take a color pair to a verdict:

  1. Parse and flatten. Each input is parsed to 8-bit sRGB channels (hex, rgb(), hsl(), or a CSS name). If a color carries an alpha channel it is composited onto a solid color first — the background over white, the text over the background — because the WCAG luminance definition only applies to solid colors.
  2. Linearise each channel. Normalise a channel to cs = c / 255, then apply the sRGB transfer function: cs / 12.92 when cs ≤ 0.04045, otherwise ((cs + 0.055) / 1.055) ^ 2.4.
  3. Relative luminance. Combine the linear channels with the BT.709 weights: L = 0.2126·R + 0.7152·G + 0.0722·B. Green dominates because the human eye is most sensitive to it.
  4. Contrast ratio. ratio = (L_lighter + 0.05) / (L_darker + 0.05), where the 0.05 term models ambient screen flare. The result runs from 1:1 (identical colors) to 21:1 (black on white).

The ratio is then compared against the fixed thresholds: 4.5:1 for normal text and 3:1 for large text at level AA (SC 1.4.3), 7:1 and 4.5:1 respectively at AAA (SC 1.4.6), and 3:1 for user-interface components and graphics (SC 1.4.11). Text counts as large at 18pt (≈24px) regular or 14pt (≈18.66px) bold, so picking a size and weight selects the right gate. To keep results trustworthy the same ratio is computed twice — once by the shared site color engine and once by an independent implementation of the W3C formula — and the two are asserted to agree to within 0.001 before the tool ships.

When a pair fails, the nudge to pass feature converts the color to HSL and binary-searches its lightness toward black or white (whichever raises contrast) until it reaches the next failing threshold, then reports the nearest compliant color. If no lightness on that axis can reach the target, it says so rather than offering a color that does not actually pass.

Worked examples

Black text on white — the maximum

#000000 on #FFFFFF

  1. L(black) = 0, L(white) = 1.0
  2. ratio = (1.0 + 0.05) / (0 + 0.05) = 1.05 / 0.05
  3. = 21.00 : 1
  4. Passes AA and AAA for all text sizes, and non-text. 21:1 is the highest ratio possible.

Mid-grey on white — the classic near-miss

#777777 on #FFFFFF

  1. Grey channel 119/255 = 0.4667 → linearised 0.18448 (all channels equal, so L = 0.18448)
  2. ratio = (1.0 + 0.05) / (0.18448 + 0.05) = 1.05 / 0.23448
  3. = 4.48 : 1
  4. Fails AA normal (needs 4.5:1) but passes AA large (≥ 3:1).
  5. Nudge darkens the text to #767676 → 4.54:1, which now passes AA normal.

White on sapphire — this site's brand pair

#FFFFFF on #1E3A8A

  1. Background linearised: R 0.01297, G 0.04229, B 0.25422
  2. L(sapphire) = 0.2126·0.01297 + 0.7152·0.04229 + 0.0722·0.25422 = 0.05137
  3. ratio = (1.0 + 0.05) / (0.05137 + 0.05) = 1.05 / 0.10137
  4. = 10.36 : 1
  5. Passes AA and AAA for both normal and large text — the brand pairing is accessible.

Frequently asked questions

Sources & references

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.