Toolstia / Color contrast checker
Check colour contrast for accessibility
Text that looks fine on your own bright monitor can be hard to read for someone with low vision, someone outdoors in sunlight, or anyone on a dim screen. The Web Content Accessibility Guidelines turn that problem into a number: the contrast ratio between the text color and the background color. This tool computes it for any two hex colors and tells you which WCAG thresholds the pair clears.
Designers use it while choosing a palette, developers use it to check a button or link color before shipping, and site owners use it when an accessibility audit flags a page. You get the ratio, a live sample in large and normal text, and a pass or fail for each of five requirements, with a button to swap the two colors.
4.54:1
- Normal text, level AA (4.5:1): Pass
- Large text, level AA (3:1): Pass
- Normal text, level AAA (7:1): Fail
- Large text, level AAA (4.5:1): Pass
- Buttons and icons (3:1): Pass
How it works
- Enter the text colour and the background colour as hex codes, or pick them.
- Read the ratio and the pass or fail results.
- Adjust a colour until the level you need passes.
What the ratio means
The ratio runs from 1:1 (no difference) to 21:1 (black on white). It compares how bright the two colours are, using the formula in the WCAG guidelines. A higher ratio is easier to read, especially for people with low vision.
The levels
Level AA needs 4.5:1 for normal text and 3:1 for large text. Level AAA needs 7:1 and 4.5:1. Large text means about 24 px, or about 19 px if bold. Buttons, icons and form borders need 3:1.
What it cannot judge
The ratio does not cover colour-blindness, thin fonts or patterned backgrounds. Treat a pass as a minimum, not a guarantee.
Hex codes
Use three or six digit codes such as #fff or #1b2733. The # sign is optional.
The calculation, step by step
Each color channel is scaled to 0 to 1, then linearized: values at or below 0.03928 are divided by 12.92, and larger values use ((v + 0.055) / 1.055) raised to the power 2.4. The relative luminance is then 0.2126 times red plus 0.7152 times green plus 0.0722 times blue. Green carries most of the weight because the eye is most sensitive to it.
The ratio is (lighter luminance + 0.05) divided by (darker luminance + 0.05). The 0.05 term models a little ambient light and keeps the answer finite for black. Pure black on pure white comes out at exactly 21, and two identical colors give 1.
Worked examples with real results
Gray #767676 on white gives 4.54:1, which just passes AA for normal text. Move one step lighter to #777777 and the ratio drops to 4.47, a fail for normal text even though the two grays look identical on screen. That is why this tool is pre-filled with #767676: it is about the lightest neutral gray that passes AA on white.
Pure red #ff0000 on white is only 3.99:1, so it passes for large text and interface parts but fails for body copy. A mid blue #0066cc on white reaches 5.56:1 and passes AA. White text on #2563eb scores 5.16:1, a pass for AA but short of AAA. Near-black #1b2733 on a warm off-white #f4f1ea gives 13.44:1, which clears every level.
Ratios are checked unrounded
The pass or fail logic uses the full-precision ratio, and only the displayed number is cut to two decimals. A displayed 4.47 therefore means the pair really is below 4.5, not that a rounding rule pushed it under. When you are close to a threshold, nudge the lighter or darker color by a few steps and watch the ratio rather than trusting your eyes.
Choosing between normal text, large text and interface parts
The checker lists five rows because WCAG sets different minimums depending on what is being drawn. Body text needs 4.5:1 for AA. Large text, which WCAG defines as roughly 24 CSS pixels or 19 pixels in bold, only needs 3:1. Components such as button outlines, icons and form field borders also use 3:1, which is why the large AA row and the interface row always agree here.
If you are unsure whether your heading counts as large, check it against the normal-text row. Passing the stricter test is always safe.
What a pass still does not guarantee
This tool only compares two solid hex colors. It does not model transparency, gradients, text over photographs, hover and focus states, or color vision deficiencies, and it does not account for very thin font weights that are hard to read even at a high ratio. It also accepts hex codes only, so convert RGB, HSL or named colors to hex first.
For a background image or gradient, test the worst spot, meaning the point where the text sits over the color closest to the text color.
Fixing a failing pair with the least visual change
Darken or lighten only the text color first, since the background usually carries the brand. Small steps in lightness change the ratio faster than hue changes do. If a brand color must stay, place it on a darker or lighter surface, or use it for large headings and icons where 3:1 is enough, and use a darker shade of the same hue for small text.
Questions
Which level should I aim for?
AA is the usual legal and policy target for websites. AAA is stricter and not always possible for every colour.
Is the ratio rounded?
It is cut off, not rounded up, to two decimals, so a result of 4.49 is never shown as a pass at 4.5.
Does it work for dark mode?
Yes. The ratio is the same whichever colour is lighter.
Is anything uploaded?
No. Your colours stays in your browser and is never sent anywhere.
Does the order of foreground and background matter?
No. The formula always divides the lighter luminance by the darker one, so black on white and white on black give the same ratio. The swap button is just a convenience for testing a dark theme.
Why do two colors that look different give the same pass result?
Contrast depends on luminance, not hue. A red and a green can have nearly the same luminance and therefore a very low ratio, even though they look quite different to a person with typical color vision.
Is 4.5:1 a legal requirement?
It is the AA threshold in WCAG 2, which many accessibility laws and procurement policies reference. Which level applies to you depends on your country and sector, so check the rule that governs your site.
Can I type a color name like navy?
No. Enter a three-digit or six-digit hex code, with or without the hash sign. If you only have an RGB value, convert it to hex first.
What ratio should placeholder text and disabled controls have?
WCAG exempts disabled controls, but placeholder text is real text and should meet the normal 4.5:1 target, since many people rely on it to understand what a field expects.