Design Tools
WCAG Colour Contrast Checker
Check text and background colours against WCAG 2.x: get the contrast ratio, AA and AAA results for normal and large text, and the closest passing text colour.
How to use WCAG Colour Contrast Checker
Enter a text colour and a background colour as HEX, rgb(), hsl() or a name, or use the pickers. The ratio, pass or fail results and a live text preview update at once; the swap button flips the two colours.
- Enter both coloursType or pick the text colour and the background colour. Shorthand such as #fff and colour names work.
- Read the resultsSee the ratio plus pass or fail for AA and AAA normal and large text and for icons and UI components.
- Apply a suggested fixIf a level fails, copy the closest text colour that passes AA or AAA, shown with its own ratio.
How the contrast ratio is calculated
Each sRGB channel is first linearised, then weighted 0.2126 for red, 0.7152 for green and 0.0722 for blue to give the relative luminance L. The ratio is (lighter L + 0.05) divided by (darker L + 0.05), which runs from 1:1 up to 21:1 for black on white. #333333 on white gives 12.63:1, while #777777 gives 4.48:1, just short of 4.5:1. Ratios are shown to two decimal places and are never rounded up across a threshold, so a ratio of 4.496 is shown as 4.49 rather than a misleading 4.50.
WCAG levels and the suggested colours
Level AA needs 4.5:1 for normal text and 3:1 for large text, meaning 24px or more, or bold at 18.66px or more. AAA raises those to 7:1 and 4.5:1, and icons and form control borders need 3:1. When a level fails, the tool keeps the hue and saturation of your text colour and changes only its lightness to find the nearest shade that passes: for #777777 on white that is #767676 at 4.54:1 for AA and #595959 at 7.00:1 for AAA. Translucent colours are composited first, text over background and background over white.
Accuracy and data handling
Review colours, dimensions and visual settings in the real component, type size and target display. The calculation runs in your current browser; the tool code does not send the input to a processing API.
FAQ
What does a 4.5:1 contrast ratio mean?
It's the WCAG 2.x level AA minimum for normal body text. Large text needs only 3:1 at AA, while the stricter AAA level asks for 7:1 for normal text and 4.5:1 for large text.
Why does my result differ slightly from another checker?
The formula is the same, so differences show up only in the last decimal. Some tools truncate, showing #777777 on white as 4.47:1; this one rounds to 4.48:1 but never rounds a failing ratio up to a pass.
Can I check translucent colours and shorthand?
Yes. #fff, rgb(), hsl(), hwb() and colour names all work. A translucent text colour is laid over the background, and a translucent background over white, before the ratio is calculated.
Does it calculate APCA or WCAG 3 scores?
No. Only WCAG 2.x ratios are calculated. APCA, proposed for WCAG 3, uses a different perceptual model, and its scores can't be compared directly with these ratios.
More Design Tools
Related toolsConvert HEX to RGB and RGB to HEX, one colour or up to 200 at a time.
Reduce sizes to a ratio, resize proportionally and get CSS aspect-ratio code.
Design a CSS box-shadow with offsets, blur, spread, opacity and inset, previewed live.
Round each corner separately and get the shortest CSS border-radius shorthand.
Calculate PPI, pixel pitch and physical size from a screen's resolution and diagonal.
Pick or paste a colour and get HEX, RGB, HSL, HWB, HSV and CMYK codes at once.