Light grey text on a white background might look elegant in a design file, but many real visitors struggle to read it. People with low vision, older adults, anyone reading on a phone in bright sunlight, and anyone with a cheap or dim screen all need enough difference between text and background. Poor contrast is one of the most common accessibility problems on the web.
The free Contrast Checker on RexBD measures the contrast ratio between two colours, tells you whether the pair passes the Web Content Accessibility Guidelines (WCAG) at AA and AAA levels, and suggests the nearest colour that passes. This guide explains how to use it and what the numbers mean.
What contrast ratio means
Contrast ratio compares the relative luminance (perceived brightness) of two colours. It ranges from 1:1 (identical colours, no contrast) to 21:1 (pure black on pure white).
The calculation, defined in WCAG, converts each colour's red, green and blue values into a luminance figure that accounts for how human eyes perceive brightness, then compares the lighter one with the darker one. You do not need to calculate it yourself; the checker does it instantly.
The WCAG thresholds
WCAG 2.1, the widely used accessibility standard published by the W3C, sets these minimum ratios:
| Content | Level AA | Level AAA |
|---|---|---|
| Normal text | 4.5:1 | 7:1 |
| Large text | 3:1 | 4.5:1 |
| User interface components and graphics (icons, input borders, focus indicators) | 3:1 | โ |
Large text means at least 18 point (about 24 CSS pixels) for regular weight, or at least 14 point (about 18.66 CSS pixels) for bold.
Level AA is the common target for websites and is referenced by accessibility laws and policies in many countries. Level AAA is stricter and recommended where possible, especially for long reading.
How to use the Contrast Checker
Step 1: Enter the text colour
Open the Contrast Checker and enter the text colour as a HEX code (such as #6b7280) or pick it.
Step 2: Enter the background colour
Enter the background colour.
Step 3: Read the ratio and results
The checker shows the contrast ratio and whether the pair passes AA and AAA for normal and large text, along with a live preview.
Step 4: Use the suggested fix
If the pair fails, the checker suggests the nearest colour that passes, keeping your design as close to the original as possible. Copy the new colour code into your design.
Everything runs in your browser.
Examples
| Text | Background | Ratio (approx.) | Normal text AA |
|---|---|---|---|
| #000000 black | #ffffff white | 21:1 | Pass |
| #374151 dark grey | #ffffff white | 10.3:1 | Pass |
| #6b7280 mid grey | #ffffff white | 4.8:1 | Pass |
| #9ca3af light grey | #ffffff white | 2.5:1 | Fail |
| #ffffff white | #3b82f6 blue | 3.7:1 | Fail (passes for large text) |
| #ffffff white | #1d4ed8 dark blue | 6.7:1 | Pass |
Notice how a small darkening of a colour can turn a fail into a pass. White text on a bright blue button is a very common failure; a slightly darker blue fixes it.
Common contrast problems and fixes
Light grey body text
Designers often use light grey for a soft look. Darken it until it reaches at least 4.5:1. Mid-greys around #6b7280 or darker on white usually pass.
Placeholder text in forms
Placeholder text is often very light and fails contrast. Better still, do not rely on placeholders for important instructions; use a visible label.
Text on brand-coloured buttons
Bright brand colours such as orange, yellow, light green and sky blue often fail with white text. Options: use dark text instead, darken the button colour, or make the text large and bold.
Text on images and gradients
Contrast varies across a photo or gradient. Add a dark overlay behind the text, or place text on the darkest area, then check the worst case. For gradients, test the text colour against both ends; the CSS Gradient Generator helps you adjust stops.
Disabled buttons and links
WCAG does not require disabled controls to meet contrast, but users still need to recognise them. Make sure links are distinguishable from body text by more than colour alone, for example with an underline.
Contrast in dark mode
Many websites and apps now offer a dark theme. Dark mode has its own contrast pitfalls:
- Pure white text on pure black (21:1) can feel harsh and cause a "halo" effect for some readers, especially people with astigmatism. Many designers use off-white text (such as #e5e7eb) on a very dark grey background (such as #111827), which still gives a high ratio, around 14:1, but feels softer.
- Saturated colours glow on dark backgrounds. A bright blue link that works on white may look too intense on black. Lighter, less saturated versions often read better.
- Grey secondary text becomes too dim. A grey that passes on a dark background in your design tool may fail on real screens. Check every text colour, not only the main one.
- Check both themes separately. A colour pair that passes in light mode tells you nothing about dark mode.
When you use CSS variables for colours, define a full set for each theme and run each pair through the checker.
A contrast checklist for a website
Before launching a new design, check these pairs:
- Body text on the main background.
- Secondary or muted text, such as dates and captions.
- Link colour on the background, and links inside coloured boxes.
- Button text on each button colour, including hover states.
- Text in the header and footer, which often have different backgrounds.
- Form labels, input text, placeholders and input borders.
- Error, warning and success messages.
- Text over hero images and gradients, at the worst spot.
- Icons that carry meaning without a text label.
- Everything again in dark mode, if you have one.
Why contrast matters beyond compliance
- Readability for everyone: good contrast helps all readers, especially on phones outdoors.
- Ageing eyes: contrast sensitivity declines with age.
- Colour vision deficiency: about 1 in 12 men and 1 in 200 women have some form of colour blindness. Contrast in lightness helps even when colours are hard to tell apart. Test designs with the Colour Blindness Simulator.
- Legal requirements: many governments and large organisations require WCAG AA compliance for their websites.
- Conversions: readable buttons and text help users complete forms and purchases.
Beyond colour contrast
Contrast is one piece of accessibility. Others include:
- Do not rely on colour alone to convey meaning; add text or icons (for example, error messages, not just red borders).
- Use readable font sizes; 16 px is a common minimum for body text.
- Make focus indicators clearly visible for keyboard users.
- Provide alternative text for images. The Image Alt Checker finds missing alt text.
- Structure content with proper headings. See the Heading Structure Checker.
Our contrast tips and mistakes article covers dark mode and design systems.
Frequently asked questions
What contrast ratio do I need?
At least 4.5:1 for normal text and 3:1 for large text to meet WCAG AA. For AAA, 7:1 and 4.5:1.
What counts as large text?
At least 18 point (about 24 px) regular, or 14 point (about 18.66 px) bold.
Do logos need to meet contrast rules?
No. WCAG exempts text that is part of a logo or brand name.
Does contrast apply to icons?
Yes. Meaningful icons and interface elements such as input borders should reach at least 3:1 against their background.
Is the suggested colour always close to mine?
The checker finds the nearest colour that passes, changing lightness while keeping the hue, so the result stays close to your original.
Can I enter RGB or HSL colours?
Use HEX codes in the checker. To convert RGB, HSL or other formats to HEX first, use the free Colour Converter.
Is the Contrast Checker free?
Yes. It is free and runs in your browser.
Keep reading
How to Build a Colour Palette From One Colour (Colour Harmony Guide)Colour & design ยท 7 min read
How to Create CSS Gradients: Linear, Radial and Conic (With Examples)Colour & design ยท 7 min read
Gold Weight Converter Guide: Bhori, Ana, Rati, Point and GramsUnit converters ยท 8 min read
How to Calculate the Days Between Two Dates (Exact Date Difference)Date & time ยท 7 min read
How to Convert Time Zones From Bangladesh (BST) to Anywhere in the WorldDate & time ยท 7 min read
How to Calculate Your BMI (With Asian and WHO Cut-offs Explained)Everyday & business ยท 7 min read
