WEB & FRONT-END · CLIENT-SIDE MATH
WCAG Contrast Compliance Calculator
Checks a text/background pair against AA and AAA for normal or large text using font size and weight. Free, instant and entirely client-side.
WCAG 2.2 success criterion 1.4.3 covers normal text contrast.
Checks a text/background pair against AA and AAA for normal or large text using font size and weight.
- Good LCP threshold
- ≤2.5 s
- Source: web.dev / Core Web Vitals
- Good INP threshold
- ≤200 ms
- Source: web.dev / Core Web Vitals
- Good CLS threshold
- ≤0.1
- Source: web.dev / Core Web Vitals
- Default root font size
- 16 px
- Source: Browser default
Quick answer
Checks a text/background pair against AA and AAA for normal or large text using font size and weight. The calculator applies Large text = font size ≥ 24px, or ≥ 18.66px when font weight ≥ 700. and shows every intermediate value.
On this page
- 1Quick Answer
- 2Interactive Calculator
- 3WCAG Contrast Compliance Calculator: CSS & Layout Breakdown
- 4Key Takeaways
- 5Web Development & Front-End: Reference Numbers
- 6WCAG Contrast Compliance Calculator: Implementation Options Compared
- 7Reference Tables
- 8Formulas & How to Use
- 9Worked Examples
- 10Advanced Web Development & Front-End Guide: WCAG Contrast Compliance Calculator
- 11Language Playbooks
- 12Glossary
- 13Mistakes & Pro Tips
- 14Use Cases
- 15Related Calculators
- 16Long-Tail Answers
- 17FAQs (27)
- 18References
Interactive Calculator
Enter a value — every result updates instantly, in your browser. Free forever, no sign-up.
WCAG Contrast Compliance Calculator
Every input is evaluated locally in your browser with deterministic, auditable arithmetic.
Live result
9.86 : 1
Contrast ratio
9.86 : 1
Foreground luminance
0.0519
Background luminance
0.9548
WCAG AA
Pass
WCAG Contrast Compliance Calculator: CSS & Layout Breakdown
Converted units, resolved values and the assumptions behind the layout math.
| Contrast ratio | 9.86 : 1 |
|---|---|
| Foreground luminance | 0.0519 |
| Background luminance | 0.9548 |
| WCAG AA | Pass Requires 4.5:1 for normal text |
| WCAG AAA | Pass Requires 7:1 for normal text |
| Text size | Normal text |
Step-by-step calculation
- 1Luminance foreground = 0.0519; background = 0.9548.
- 2Ratio = (L1 + 0.05) ÷ (L2 + 0.05) = 9.86 : 1.
- 3AA needs 4.5:1 for normal text; AAA needs 7:1.
- 4This pair passes AAA for normal text as well.
Key Takeaways
The 30-second version — the exact answers Google loves to feature.
- 1WCAG 2.2 success criterion 1.4.3 covers normal text contrast.
- 2Disabled controls and decorative text are exempt, but readability still matters.
- 3Bold 18.66px text qualifies as large under WCAG.
- 4The result is deterministic: the same inputs and options produce the same output.
- 5Use the breakdown to verify the headline number before acting on it.
Web Development & Front-End: Reference Numbers
Useful thresholds and rules of thumb for interpreting the result.
- Good LCP threshold
- ≤2.5 s
- Source: web.dev / Core Web Vitals
- Good INP threshold
- ≤200 ms
- Source: web.dev / Core Web Vitals
- Good CLS threshold
- ≤0.1
- Source: web.dev / Core Web Vitals
- Default root font size
- 16 px
- Source: Browser default
WCAG Contrast Compliance Calculator: Implementation Options Compared
Choose the workflow that matches your accuracy, automation and review needs.
Design handoff
Best for: Translating a visual spec into CSS values
- Method: Convert units, ratios and color values once, then store them as design tokens.
- Precision: Exact for the chosen base; depends on the root and parent font sizes.
- Safeguards: Document the base font size and check the result in the browser.
Component implementation
Best for: Building a reusable UI component
- Method: Use relative units and container-aware layout, then test at narrow and wide widths.
- Precision: Approximate until measured in the real layout.
- Safeguards: Test zoom, long content and reduced-motion settings.
Performance audit
Best for: Diagnosing layout shift, payload and rendering issues
- Method: Measure field data and lab traces, then compare against Core Web Vitals thresholds.
- Precision: Field data is realistic; lab data is reproducible but synthetic.
- Safeguards: Segment by device and connection type before optimising.
Quick Reference Tables
Widths, ranges, boundary values and language types — the lookup tables you will come back to.
Core Web Vitals thresholds
| Metric | Good | Needs improvement | Poor |
|---|---|---|---|
| LCP | ≤2.5 s | 2.5–4.0 s | >4.0 s |
| INP | ≤200 ms | 200–500 ms | >500 ms |
| CLS | ≤0.1 | 0.1–0.25 | >0.25 |
WCAG Contrast Compliance Calculator: Input Reference
Documented defaults and expected formats for every input on this page.
| Input | Type | Default | What it controls |
|---|---|---|---|
| Text color | Text | #374151 | Value used by the wcag contrast compliance calculator. |
| Background color | Text | #f9fafb | Value used by the wcag contrast compliance calculator. |
| Font size (px) | Number | 16 | Value used by the wcag contrast compliance calculator. |
| Font weight | Number | 400 | Value used by the wcag contrast compliance calculator. |
Formulas & How to Use This Calculator
Core relationship
Large text = font size ≥ 24px, or ≥ 18.66px when font weight ≥ 700.
Verification checklist
1. Confirm the base font size or viewport used by the calculation. 2. Recompute the conversion by hand. 3. Inspect the computed value in DevTools. 4. Test at 200% zoom and a narrow viewport.
How to use — step by step
- Enter the CSS values or measurements that wcag contrast compliance calculator needs.
- Set the root, parent or viewport base that the calculation depends on.
- Read the converted value and the generated CSS where provided.
- Check the result in the browser at the target viewport and zoom level.
- Test a long label, a narrow container and a user-increased font size.
- Store the final value as a documented token or component rule.
Worked Examples
Real numbers and raw bits, fully worked — copy the pattern for your own code or protocol.
Default scenario
Inputs
Text color: #374151 · Background color: #f9fafb · Font size (px): 16 · Font weight: 400
Math
Luminance foreground = 0.0519; background = 0.9548. Ratio = (L1 + 0.05) ÷ (L2 + 0.05) = 9.86 : 1.
Result
9.86 : 1 — Contrast ratio: 9.86 : 1; Foreground luminance: 0.0519
2× larger inputs
Inputs
Text color: #374151 · Background color: #f9fafb · Font size (px): 32 · Font weight: 800
Math
Luminance foreground = 0.0519; background = 0.9548. Ratio = (L1 + 0.05) ÷ (L2 + 0.05) = 9.86 : 1.
Result
9.86 : 1 — Contrast ratio: 9.86 : 1; Foreground luminance: 0.0519
Sensitivity check
Inputs
Text color: #374151 · Background color: #f9fafb · Font size (px): 48 · Font weight: 400
Math
Luminance foreground = 0.0519; background = 0.9548. Ratio = (L1 + 0.05) ÷ (L2 + 0.05) = 9.86 : 1.
Result
9.86 : 1 — Contrast ratio: 9.86 : 1; Foreground luminance: 0.0519
Advanced Web Development & Front-End Guide: WCAG Contrast Compliance Calculator
WCAG Contrast Compliance Calculator explained beyond the formula — assumptions, edge cases, thresholds and the workflows professionals use.
CSS units and the formatting context
A CSS length is resolved relative to a context. px is absolute in CSS terms but scaled by the device pixel ratio and browser zoom. rem is relative to the root font size, em to the element’s inherited font size, and percentages to the containing block or another property-specific base. WCAG Contrast Compliance Calculator makes that base explicit. When a value looks wrong in the browser, inspect the computed styles first; the declared value is only part of the story.
How the calculation works
Checks a text/background pair against AA and AAA for normal or large text using font size and weight. The core relationship is: Large text = font size ≥ 24px, or ≥ 18.66px when font weight ≥ 700. Use the result as a starting point, then confirm it in the browser at the actual viewport, font size and zoom level. Design tools often round values; production CSS should keep enough precision to avoid cumulative layout drift, especially in grids and nested components.
Responsive layout and content-driven breakpoints
Device-specific breakpoints age quickly. Better breakpoints come from where the content actually breaks: a card grid that becomes cramped, a navigation bar that wraps, or a table that overflows. Resize the viewport gradually and add a breakpoint at the first failure. Use modern layout primitives such as flex-wrap, grid auto-fit and container queries to reduce the number of explicit breakpoints.
Accessibility and user preferences
Users can change the browser’s default font size, zoom the page, or request reduced motion and higher contrast. rem-based typography respects the first; fixed px does not. Avoid locking text into viewport units without a clamp, and never disable zoom. Check color contrast against the final rendered colors, including opacity and gradients. Accessibility is part of correctness, not a separate polish step.
Layout shift and reserved space
Cumulative Layout Shift measures unexpected movement of visible content. Images without dimensions, late-loading fonts, injected banners and ads are common causes. Reserve space with aspect-ratio, width and height attributes, or a min-height placeholder. For wcag contrast compliance calculator, check whether the computed size changes after fonts or images load. Stable geometry is often more valuable than a tiny visual tweak.
Colors, contrast and perception
Hex, RGB and HSL are different representations of the same color model, not different colors. Alpha compositing blends a translucent color with its backdrop, so the final contrast depends on what is underneath. Relative luminance is calculated after linearising sRGB channels; a mid-gray can have far less luminance than its numeric value suggests. Always test the composited result, not only the declared color.
Performance budgets for CSS and images
Stylesheets and images compete for bandwidth and main-thread time. A large CSS bundle delays rendering; an oversized hero image delays Largest Contentful Paint. Set budgets for compressed transfer size, image dimensions and the number of render-blocking requests. Generate responsive image variants and use modern formats with fallbacks. Measure on a mid-range mobile device, not only on a fast desktop.
Testing across browsers and input modes
A value that works in one browser may behave differently in another because of default styles, scrollbar width, font metrics or support for newer units. Test the actual interaction with keyboard, touch and zoom. Use feature queries for progressive enhancement rather than browser sniffing. For wcag contrast compliance calculator, keep a small visual regression suite around the component so a future CSS change cannot silently break the layout.
Language & Platform Playbooks
The same bit pattern behaves differently in every language. Here is how to adapt the conversion safely.
Design tokens
Compute wcag contrast compliance calculator once, then store the result as a named token rather than scattering magic numbers. Document the base font size, viewport assumptions and fallback. Tokens make a global change reviewable and keep components consistent across the design system.
Component CSS
Apply the value inside the component and test it with long labels, narrow containers and 200% zoom. Prefer relative units for type and spacing, and use minmax(0, 1fr) or min-width: 0 where content could force overflow. Confirm the computed value in DevTools rather than trusting the source.
Responsive QA
Check wcag contrast compliance calculator at the smallest supported width, a typical tablet width and a wide desktop. Test with the browser’s default font size increased, with a long translation, and with images blocked. Add a regression screenshot for the breakpoint where the layout changes.
Performance audit
Measure LCP, INP and CLS in the field if possible, then reproduce the slowest case in the lab. Use the result from wcag contrast compliance calculator to set a budget, and verify the compressed transfer size. Optimise the largest contributor first rather than shaving many tiny assets.
Glossary: Key Terms Explained
- rem
- A length unit relative to the root element’s computed font size.
- em
- A length unit relative to the current element’s inherited font size.
- Viewport unit
- A length unit based on the viewport width, height or their smaller/larger dimension.
- Specificity
- The weight of a CSS selector that determines which competing declaration wins.
- Aspect ratio
- The proportional relationship between width and height, often reserved before media loads.
- Layout shift
- Unexpected movement of visible content as resources load or fonts swap.
Common Mistakes & Pro Tips
Mistakes that break conversions
- Classifying text as large based on CSS pixels while the user zooms.
- Forgetting placeholder and helper text, which also need contrast.
- Assuming 1rem always equals 16px regardless of user settings.
- Using viewport units for body text without a clamp, making it unreadable at extremes.
- Forgetting that percentages resolve against different bases depending on the property.
- Checking contrast on the declared color instead of the composited result.
Pro tips for production code
- Check the computed font size and weight, not the design token name.
- Audit focus rings and icons as non-text contrast too.
- Use rem for global type and spacing, em for component-local scaling.
- Reserve image space with aspect-ratio or explicit dimensions.
- Test at 200% zoom and with a larger default font size.
- Prefer content-driven breakpoints over device-specific ones.
Who Should Use This Calculator?
- ▸ Design-system accessibility review.
- ▸ Pre-release WCAG audit.
- ▸ Converting a design spec to CSS.
- ▸ Auditing responsive typography.
- ▸ Fixing layout shift and contrast issues.
- ▸ Building a design-token scale.
Related Programming Calculators
Keep going — every tool below links directly into this workflow.
People Also Search For
Tap a long-tail question to jump to the matching FAQ answer.
Frequently Asked Questions (27)
Long-tail answers: each question targets a real Google search about wcag contrast compliance calculator — click to expand.
Showing 27 of 27 answers.
Does large bold text really need less contrast?
Which browsers support wcag contrast compliance calculator?
Should I use px, rem or em for wcag contrast compliance calculator?
How does wcag contrast compliance calculator affect accessibility?
Why does wcag contrast compliance calculator look different in my browser?
Can I use wcag contrast compliance calculator with a design system?
How does wcag contrast compliance calculator relate to Core Web Vitals?
What does the WCAG Contrast Compliance Calculator calculate?
How do I use the WCAG Contrast Compliance Calculator?
What formula does the WCAG Contrast Compliance Calculator use?
Is the WCAG Contrast Compliance Calculator accurate?
Is the WCAG Contrast Compliance Calculator free and private?
Does the WCAG Contrast Compliance Calculator work offline?
What units does the WCAG Contrast Compliance Calculator use?
Can I use the WCAG Contrast Compliance Calculator in CI or automation?
Why do my results differ from another tool?
How do I verify the WCAG Contrast Compliance Calculator result by hand?
What is a common mistake when using the WCAG Contrast Compliance Calculator?
Does the WCAG Contrast Compliance Calculator handle large inputs?
How do I share a WCAG Contrast Compliance Calculator result?
Which related calculators should I use next?
Can the WCAG Contrast Compliance Calculator handle zero or empty values?
Where can I learn more about the method behind the WCAG Contrast Compliance Calculator?
Does the WCAG Contrast Compliance Calculator send my inputs to a server?
Can I use the WCAG Contrast Compliance Calculator for production decisions?
What should I check before trusting the WCAG Contrast Compliance Calculator result?
How often should I re-run the WCAG Contrast Compliance Calculator?
Resources & Authoritative References
Further reading
- MDN — CSS values and units — Reference for px, em, rem, percentages and viewport units.
- web.dev — Core Web Vitals — LCP, INP and CLS thresholds and diagnostics.
- W3C — WCAG 2.2 — Contrast, resize, reflow and motion requirements.
- Can I use — Browser support tables for CSS and web platform features.
- CSS Specifications — Normative CSS specifications.
- web.dev — Images — Responsive images, formats and loading strategy.
Authoritative sources
Was this calculator helpful?
Last updated: October 2026 · Free forever · No sign-up · Part of Programming Calculators at Atlascalcs.com · All math runs in your browser