Color Contrast Ratio (WCAG) Calculator
Enter foreground and background colors (hex code or color picker) to instantly compute the WCAG contrast ratio and see which AA / AAA accessibility levels the pair passes. Higher contrast means easier reading — useful for web, app and presentation design.
Enter a valid hex color (e.g. #1a73e8 or #abc).
Contrast ratio
8.59
Preview
Large text sample (≥ 18pt or 14pt bold)
The quick brown fox jumps over the lazy dog · 敏捷嘅棕色狐狸跳過懶狗
Normal text sample
The quick brown fox jumps over the lazy dog · 敏捷嘅棕色狐狸跳過懶狗
- AA · Normal text
- Min 4.5:1
- —
- AA · Large text
- Min 3:1
- —
- AAA · Normal text
- Min 7:1
- —
- AAA · Large text
- Min 4.5:1
- —
- UI components / graphics
- Min 3:1
- —
Uses the WCAG 2.1 / 2.2 contrast formula. Large text is ≥ 18pt regular or ≥ 14pt bold.
Formula
contrast = (L₁ + 0.05) / (L₂ + 0.05), where L is relative luminance (0–1) and L₁ ≥ L₂
- · Relative luminance first linearises each sRGB channel — c ≤ 0.04045 uses c/12.92, otherwise ((c+0.055)/1.055)^2.4 — then takes L = 0.2126·R + 0.7152·G + 0.0722·B.
- · Ratios range from 1:1 (identical colors) up to 21:1 (pure black on pure white).
- · WCAG 2.1 / 2.2 thresholds: AA normal text ≥ 4.5:1, AA large text ≥ 3:1; AAA normal ≥ 7:1, AAA large ≥ 4.5:1.
- · UI components, icons, charts and other non-text content pass at ≥ 3:1 (WCAG 2.1 SC 1.4.11).
- · Large text means ≥ 18pt (24 px) regular, or ≥ 14pt (18.66 px) bold.
- · Source: W3C WCAG 2.1 (2018) / 2.2 (2023) — www.w3.org/TR/WCAG21/#contrast-minimum
Frequently asked
What is the difference between 4.5:1 and 3:1?
4.5:1 is the WCAG AA minimum for "normal" body text (the size you are reading now). 3:1 covers "large" text (≥ 18pt regular or ≥ 14pt bold) and the boundaries of UI components and graphical objects, because thicker strokes need less luminance contrast. For the stricter AAA level, body text needs 7:1 and large text 4.5:1.
Does the calculator ignore alpha (transparency)?
Yes. The WCAG formula expects opaque sRGB colors. Semi-transparent foregrounds must first be alpha-blended against the actual background to obtain an opaque rendered color. Use your browser DevTools to read the rendered RGB and paste that here.
Does this tool support the new APCA algorithm in WCAG 3.0?
Not yet. This tool implements the WCAG 2.1 / 2.2 relative-luminance formula — it has been the de-facto industry standard for over 15 years and is what regulations such as the EU European Accessibility Act and US ADA Title III continue to reference. WCAG 3.0 is still a Working Draft and APCA (Advanced Perceptual Contrast Algorithm) has not yet been formally adopted.
Yellow on white clearly looks awful — why might it still pass?
WCAG ratio measures relative luminance only — it does not capture hue contrast. Yellow and white are very close in luminance so most yellow-on-white combinations fail WCAG, but some high-yellow can squeak through while still being hard to read. Treat WCAG as a minimum bar, not a guarantee — always validate with color-blindness simulators and real low-vision users.
Related tools
Length Unit Converter
Cm, m, km, in, ft, yd, mi — common length units, converted instantly.
Temperature Converter
Convert between Celsius (°C), Fahrenheit (°F) and Kelvin (K) instantly.
Shoe Size Converter (US / UK / EU / CM)
Enter your foot length or a size in any system to see the equivalent US / UK / EU and centimetre sizes.
Paper Size Reference
Pick a paper size (A0–A10, B / C series, Letter, Legal, card sizes) to see its mm / cm / inch / pixel dimensions.
Number Base Converter (Binary / Octal / Decimal / Hex)
Convert a number simultaneously between binary, octal, decimal and hexadecimal — useful for programmers, students and electronics work.
Aspect Ratio & Screen Size Calculator
From an aspect ratio and one side, find the other; or from a diagonal and ratio, get real width and height (4:3, 16:9, 21:9 …).
Data Storage Unit Converter (B/KB/MB/GB/TB)
Convert between bytes, KB, MB, GB, TB and PB — distinguishing decimal (1000-base, drive labels) from binary (1024-base, OS-reported).
RGB ↔ HEX ↔ HSL Color Converter
Convert between HEX (#RRGGBB), RGB(0–255) and HSL(0–360, 0–100, 0–100) instantly — with a live colour preview swatch.
Tire Size Calculator (Spec / Diameter / Speedometer Error)
Convert a P-metric tire spec (e.g. 225/65R17) into sidewall height, overall diameter, circumference and revolutions per km — and compare against a reference size to see speedometer error.
Energy Unit Converter (J / kJ / cal / kcal / kWh / BTU / Wh)
Convert between joules, kilojoules, calories, kilocalories, kilowatt-hours, BTU and watt-hours in a single view — for nutrition labels, electricity bills, heating and fuel comparisons.
Pressure Unit Converter
Convert between Pa, kPa, bar, mbar, atm, psi, mmHg, Torr and inHg in a single view — all the everyday pressure units.
Torque Unit Converter
Convert between N·m, kgf·m, kgf·cm, lbf·ft, lbf·in and ozf·in — all the torque units used on torque wrenches, bicycle bolts and car service specs.
Angle Unit Converter
Convert between degrees, radians, gradians, turns, arcminutes, arcseconds, milliradians and NATO mil — with live sin/cos/tan values for reference.
Fuel Economy Converter (MPG ⇄ L/100km)
Convert between L/100km, km/L, US MPG and UK (imperial) MPG — compare car efficiency figures across regions without arithmetic.
Power Unit Converter
Convert between W, kW, MW, mechanical horsepower (hp), metric horsepower (PS), BTU/hr, ft·lbf/s, cal/s, kcal/h and refrigeration tons in one view.
px ↔ rem ↔ em Converter
Pick a root font-size (defaults to 16 px) and convert any CSS pixel, rem, em, percentage or point value into the others, with a reference table for common sizes.
Alcohol ABV ↔ Proof Converter & Standard Drinks Calculator
Convert alcohol by volume (ABV %) to US proof and UK proof, plus compute grams of pure alcohol and "standard drinks" per pour for US / UK / AU / HK.
Bandwidth & Throughput Converter (Mbps ↔ MB/s)
Convert network bandwidth (kbps, Mbps, Gbps) to file-transfer rate (KB/s, MB/s, MiB/s) and estimate how long a given file size takes.
Weight / Mass Unit Converter
Kilograms, grams, milligrams, pounds, ounces, stones, tonnes, jin and tael — common mass units, converted instantly.
Battery mAh ↔ Wh Converter (Power Bank Airline Rules)
Enter battery capacity (mAh) and voltage (V) to get watt-hours (Wh) instantly — with a live IATA airline check (100 Wh / 160 Wh cut-offs).
International Bra Size Converter
Enter underbust and bust (or pick a local size) to convert bra sizes across US, UK, EU, AU and JP standards.
International Ring Size Converter
Enter inner circumference (mm) or diameter to cross-reference US, UK, EU, JP and HK ring sizes.
Area Unit Converter
Square metres, hectares, acres, square feet, square miles and more — common area units, converted instantly.
Volume / Capacity Unit Converter
Litres, millilitres, cubic metres, US and imperial gallons, quarts, pints, fluid ounces, cups, tablespoons and teaspoons — converted instantly.
Speed Unit Converter
Convert freely between km/h, mph, m/s, ft/s, knots and Mach number.