By · Updated

Luminance Scorer: Batch Contrast Checker

Batch WCAG Contrast Ratios for Hex Pairs, Exported as a Table or CSV

No ratings yet

OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.

How the Luminance Scorer works

This batch contrast checker tests many colour pairs at once. Paste one foreground and background hex pair per line, separated by a space or a comma, and every pair comes back with its relative luminance values, its contrast ratio and a pass or fail against WCAG AA and AAA. Export the table as CSV for an audit.

Batch contrast checker: checking a palette at once

Checking one colour pair is easy. Checking the forty pairings a design system actually uses, with every text colour on every surface in both themes, is where a one-pair-at-a-time checker stops being useful. Paste the whole list here, one pair per line, and every row is scored at once against WCAG, with the luminance of each colour alongside.

Why it matters. Low contrast is the most common accessibility failure on the web. WebAIM's annual Million report, which audits the home pages of the top million sites, has found low contrast text on roughly four in five pages every year it has run. Around one in twelve men and one in two hundred women have some form of colour vision deficiency, and far more people read on a phone in sunlight or on a dim laptop. Contrast is also a legal matter: WCAG 2.1 and 2.2 level AA underpin the European Accessibility Act, the UK public sector regulations and most ADA settlements in the US.

How the luminance scorer works

Relative luminance is the perceived brightness of a colour, from 0 for black to 1 for white. Each sRGB channel is divided by 255, put through a curve that undoes display gamma, and weighted: 0.2126 red, 0.7152 green and 0.0722 blue. Those weights are why pure green has a luminance of 0.72 and pure blue only 0.07, even though both are one channel at full strength.

The contrast ratio formula is (lighter + 0.05) ÷ (darker + 0.05). It runs from 1:1 for identical colours to 21:1 for black on white. The 0.05 approximates light reflecting off the screen, and it is why the formula flattens small differences between very dark colours.

The thresholds follow WCAG 2.2:

Input format. Put the foreground first and the background second, separated by a space, comma, semicolon or pipe. The # is optional and three-digit shorthand such as #333 works, so you can paste straight from a spreadsheet, a CSV export or a design-token file.

Reading the results

Each row shows the two colours, the ratio, AA and AAA pass or fail, and both luminances.

Worked example. Tailwind's gray-500 (#6b7280) on gray-100 (#f3f4f6) scores 4.39:1 and fails AA for body text, even though the same grey on white passes. #767676 on white is the lightest neutral grey that passes, at 4.54:1; one step lighter, #777777, scores 4.48:1 and fails. Pure red on white is 4.00:1, fine for a large heading but not for an error message in body text.

Tips and pitfalls.

For a single pair with a live preview, use the contrast checker. To build a palette that has room for contrast from the start, try the colour harmonizer, and read colour contrast that passes WCAG for fixes that keep the brand look.

FAQ

What format should the input be in?

One pair per line, foreground first, separated by a space, comma, semicolon or pipe. Three-digit and six-digit hex are both accepted, with or without the leading #. Lines that are not a valid pair are reported in the table rather than silently dropped.

What is relative luminance?

The brightness of a colour as the eye perceives it, from 0 for black to 1 for white. It is calculated by linearising each sRGB channel and weighting them 0.2126 red, 0.7152 green and 0.0722 blue, reflecting how much each contributes to perceived brightness.

What ratio do I need to pass?

4.5:1 for body text and 3:1 for large text at WCAG AA, or 7:1 and 4.5:1 at AAA. Switch the text size option at the top and the pass and fail columns re-grade against the appropriate thresholds.

Does this cover interface elements as well as text?

Non-text elements that convey meaning — input borders, focus indicators, icons, chart series — need 3:1 against their surroundings. Select large text mode and read the AA column, which uses that same 3:1 threshold.

Can I export the results?

Yes. The table has a CSV download button, so the whole audit drops straight into a spreadsheet or an accessibility report. Nothing is uploaded — the calculation and the export both happen in your browser.

See also: all Colour tools, Layout & Spacing, Shadows & Motion, Shapes & SVG, UI Components, Forms & Inputs.

Related tools