Color Contrast Ratio Calculator
Check the contrast ratio of two colors for accessibility.
Result
How it is calculated
Each colour is converted to a relative luminance L = 0.2126 R + 0.7152 G + 0.0722 B, where each channel is first scaled to 0 to 1 and linearised (values up to 0.04045 are divided by 12.92, others use ((c + 0.055) / 1.055)2.4). The contrast ratio is (Llight + 0.05) / (Ldark + 0.05), from 1 : 1 to 21 : 1. The order of the two colours does not matter. The tool then labels the ratio using the WCAG limits: 7 or more for AAA, 4.5 or more for AA, 3 or more for large text only, and below 3 fails. Colours must be 3 or 6 digit hex codes, with or without #.
Worked example
Grey text #767676 on white #ffffff. The grey channel is 118/255 = 0.463, which linearises to about 0.181, so L = 0.181. White has L = 1. Ratio = (1 + 0.05) / (0.181 + 0.05) = 1.05 / 0.231. The tool shows 4.54 : 1 with the result Passes AA, just above the 4.5 limit for normal body text.
Common mistakes
- Judging by eye on your own screen. Brightness, glare and eyesight differ, and the ratio gives an objective check.
- Applying the 3 : 1 large-text limit to normal body text, which needs 4.5 : 1 for AA.
- Checking only the default state and forgetting hover, focus, disabled text and text over images.
- Entering a colour with a typo, or a name like red; the tool needs hex codes.
- Assuming a pass guarantees readability. Font size, weight and thin strokes still matter.
Sources
- Web Content Accessibility Guidelines (WCAG) 2.1 — W3C Recommendation
- Web Content Accessibility Guidelines (WCAG) 2.2 (relative luminance, SC 1.4.3 and 1.4.6, large text) — W3C Recommendation
About this calculator
This calculator computes the WCAG contrast ratio between two colors using (L1 + 0.05) / (L2 + 0.05), where L1 and L2 are the relative luminances of the lighter and darker colors, each derived from the sRGB channel values via the WCAG's gamma-corrected luminance formula. The result ranges from 1:1 (identical colors) to 21:1 (pure black on white), and is checked against the Web Content Accessibility Guidelines thresholds — 4.5:1 for normal text and 3:1 for large text at AA level, 7:1 and 4.5:1 respectively for the stricter AAA level.
Web designers, front-end developers, and accessibility auditors use this to ensure text and UI elements meet legal and usability accessibility standards (WCAG 2.1, ADA, Section 508 compliance) for users with low vision or color blindness.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments (1)
The ratio compares two flat colors, so it cannot judge text sitting on a gradient, a photo or a semi-transparent layer. In those cases pick the lightest and darkest spots behind the words and test each pair, since the worst one decides. Colors must be entered as hex codes here, so convert named or rgb values first. Which color pairs from your palette keep failing, and which pass only for large text?