Color Contrast Ratio Formula:
From: | To: |
The color contrast ratio measures the difference in perceived brightness between two colors. It's a crucial metric in web accessibility to ensure text is readable against its background.
The calculator uses the WCAG contrast ratio formula:
Where:
Explanation: The ratio compares the luminance of the lighter color to the darker color, with higher numbers indicating greater contrast.
Details: WCAG guidelines recommend minimum contrast ratios of 4.5:1 for normal text and 3:1 for large text. Higher ratios (7:1) are recommended for better accessibility.
Tips: Enter relative luminance values between 0 (black) and 1 (white). The calculator will determine which color is lighter and compute the ratio accordingly.
Q1: What is relative luminance?
A: Relative luminance represents how bright a color appears to the human eye, normalized to 0 for black and 1 for white.
Q2: What ratio meets WCAG AA standards?
A: 4.5:1 for normal text (3:1 for large text) meets AA, while 7:1 meets AAA standards.
Q3: How do I calculate relative luminance?
A: It's calculated from RGB values using the formula: R = 0.2126*R + 0.7152*G + 0.0722*B (for sRGB colorspace).
Q4: Why is contrast ratio important?
A: Proper contrast ensures readability for users with visual impairments, in bright sunlight, or on low-quality displays.
Q5: What's the maximum possible contrast ratio?
A: 21:1 (black on white or white on black), though real-world displays rarely achieve this perfect contrast.