Design tool · free · runs in your browser

Color Contrast Checker

Enter a text color and a background color to get the WCAG contrast ratio, pass or fail results for each level, and a live sample. If the pair fails, the tool suggests the closest text color that passes.

What this color contrast checker does

The checker measures how well a text color stands out against a background color, using the contrast ratio defined in the Web Content Accessibility Guidelines (WCAG) 2. It tells you whether the pair passes AA and AAA for normal and large text and the 3:1 minimum for interface components, shows a live sample at 16 px and 24 px, and lists both colors as hex, rgb() and hsl(). When a pair fails AA for normal text, it suggests the nearest darker or lighter text color that passes.

How to check a color pair

  1. Pick the text color with the color picker, or type a hex code (#1a2b3c or #abc) or an rgb() value.
  2. Do the same for the background.
  3. Read the ratio and the pass or fail table. Results update as you type.
  4. If the pair fails, try the suggested color, or use Swap colors to test light text on a dark background.

How the contrast ratio is calculated

WCAG compares the relative luminance of the two colors, a measure of perceived brightness from 0 for black to 1 for white. Each sRGB channel is first converted to a linear value:

c = channel ÷ 255 linear = c ÷ 12.92 if c ≤ 0.04045 linear = ((c + 0.055) ÷ 1.055) ^ 2.4 otherwise

The channels are weighted by how sensitive the eye is to each one, with green counting most:

L = 0.2126 × R + 0.7152 × G + 0.0722 × B ratio = (L_lighter + 0.05) ÷ (L_darker + 0.05)

The ratio runs from 1:1 (identical colors) to 21:1 (black on white). The WCAG 2 text quotes the threshold as 0.03928, from an older sRGB draft; for 8-bit colors both thresholds give identical results, because no channel value from 0 to 255 falls between them.

RequirementMinimum ratioWCAG criterion
Normal text, level AA4.5:11.4.3
Large text, level AA3:11.4.3
Normal text, level AAA7:11.4.6
Large text, level AAA4.5:11.4.6
UI components and graphics3:11.4.11

Large text means at least 18 point (24 CSS pixels) at regular weight, or at least 14 point (about 18.66 px) in bold. The ratio shown is truncated to two decimals rather than rounded, so a pair displayed as 4.50:1 really meets 4.5:1.

Worked examples

Gray text on white

#767676 on #ffffff gives 4.54:1 and passes AA for normal text. One step lighter, #777777, gives 4.47:1 and fails. #949494 gives 3.03:1, enough only for large text, and #959595 gives 2.99:1, which fails even that.

Pure colors

Blue #0000ff on white reaches 8.59:1 and passes AAA. Red #ff0000 on white is only 3.99:1, so red error text needs a darker shade such as #c00000 to pass AA.

A brand color as a button

White text on #2563eb gives 5.16:1, which passes AA. White on the green #16a34a gives 3.29:1: fine for a large button label, too low for small text.

Tips and common mistakes

Limits and privacy

The checker implements WCAG 2.x, the version used in current accessibility law and audits. It does not compute APCA, the experimental method proposed for WCAG 3. It assumes sRGB colors and does not simulate color vision deficiencies. All calculations happen in your browser.

Frequently asked questions

What contrast ratio do I need for WCAG AA?

At least 4.5:1 for normal text and 3:1 for large text. Large text means at least 18 point (24 px) regular, or 14 point (about 18.66 px) bold.

What does AAA require?

7:1 for normal text and 4.5:1 for large text. AAA is a stricter target that few sites meet everywhere, but it helps readers with low vision.

What is the lightest gray that passes AA on white?

#767676 gives 4.54:1 on white and passes AA for normal text. #777777 gives 4.47:1 (4.478 before truncation) and fails, which shows how close the threshold is.

Do icons and buttons need contrast too?

Yes. WCAG 2.1 success criterion 1.4.11 asks for 3:1 for parts of user interface components and graphics needed to understand them, such as input borders and icon shapes.

Why does the tool show 4.49 when the exact value is 4.4999?

Ratios are truncated to two decimals, never rounded up, so a pair that shows 4.50 really reaches 4.5:1. Rounding up could make a failing pair look like a pass.

Can I enter rgb() values or short hex codes?

Yes. #abc, #aabbcc and rgb(170, 187, 204) all work. Transparency is ignored, so check semi-transparent colors against the color they end up showing on screen.

Does it support APCA or WCAG 3?

No. It implements the WCAG 2.x formula, which is the one referenced by current accessibility laws and audits. WCAG 3 and its contrast method are still drafts.