Luminance Calculator
Calculate WCAG relative luminance, R/G/B channel breakdown, contrast ratio and automatic accessibility suggestions
Compare relative luminance between two colors, calculate WCAG contrast ratio and get automatic suggestions to improve accessibility.
Luminance Comparison
Channel Breakdown
Contrast Ratio
Acceptable
Sample Text
Small sample text
WCAG 2.1 Levels
Suggestion to reach AA
Adjust to #1E6FF5
New ratio: 4.52:1
Reference Scale
Grayscale Equivalent
The grayscale equivalent shows how the color's brightness is perceived without the hue.
W3C Formula
L = 0.2126 × R + 0.7152 × G + 0.0722 × BContrast = (L1 + 0.05) / (L2 + 0.05)Based on the standard sRGB color space.
How it works
Relative luminance measures the perceived brightness of a color on a scale from 0 (absolute black) to 1 (pure white). It is the mathematical foundation of the WCAG contrast ratio, the international standard for web accessibility.
What does this calculator offer?
- Relative luminance with exact value (0-1) and percentage
- R/G/B channel breakdown — see how much each channel contributes to total luminance
- Contribution bar — proportional red/green/blue visualization
- Reference scale — relative position vs black, grays and white
- WCAG contrast ratio with detailed AA/AAA levels
- Auto suggestion — corrected color to reach AA or AAA, with apply button
- Grayscale equivalent — brightness perception without hue
- Swap and random color for quick exploration
The Formula: Gamma Correction and ITU-R BT.709 Weights
Relative luminance is not a simple average of R, G and B. It requires two steps:
Step 1: sRGB Linearization (gamma correction)
The RGB values we use (0-255) are in sRGB space, which applies a gamma curve to approximate human perception. Before calculating luminance, we must "undo" that curve:
If C ≤ 0.03928 → C_lin = C / 12.92
If C > 0.03928 → C_lin = ((C + 0.055) / 1.055) ^ 2.4Where C is the channel value divided by 255 (0-1).
Step 2: Weighted channel contributions
The human eye is much more sensitive to green than red, and very little to blue. The ITU-R BT.709 weights reflect this:
L = 0.2126 × R_lin + 0.7152 × G_lin + 0.0722 × B_lin21.26%
71.52%
7.22%
How is the contrast ratio calculated?
Ratio = (L_lighter + 0.05) / (L_darker + 0.05)The range goes from 1:1 (no contrast) to 21:1 (black vs white). WCAG requires at least 4.5:1 for normal text (AA) and 7:1 for AAA.
Professional Tips
The Green Rule
The green channel dominates (~71%). Colors with high green (yellow, lime, cyan) will always have high luminance, even if they "look" dark.
Blue = nearly invisible
Blue only contributes ~7%. Pure blue (#0000FF) has luminance 0.07, almost black. Never use dark blue as text on a dark background.
Use the grayscale test
Convert your design to grayscale to verify visual hierarchy. If two elements merge in gray, their contrast is insufficient.
Gamma matters
Without linearization, the calculation would be wrong. A mid-gray (#808080) has luminance 0.216, not 0.5. Gamma correction is essential.
Practical Use Cases
Case 1: Choose readable text color
Your background is #F3F4F6 (light gray, L = 0.92).
→ You need text with L < 0.18 for ratio ≥ 4.5:1 (AA)
→ For AAA (7:1), you need L < 0.10
Case 2: Why does yellow look brighter than blue?
→ Yellow #FFFF00: L = 0.93 (R: 0.21 + G: 0.72 + B: 0.00)
→ Blue #0000FF: L = 0.07 (R: 0.00 + G: 0.00 + B: 0.07)
→ The channel breakdown explains it: yellow's green contributes 10× more
Case 3: Debug insufficient contrast
Two colors look different (red vs green) but fail WCAG.
→ #FF0000 (L = 0.21) vs #00AA00 (L = 0.22) → Ratio: 1.04:1
→ Nearly equal luminances = zero contrast, despite different hue
Case 4: Dark mode design
Dark background #1E293B (L = 0.024).
→ For AA normal text: need L ≥ 0.30 → light text like #94A3B8
→ For AAA: need L ≥ 0.50 → lighter text like #CBD5E1
Case 5: Validate brand palette
Your brand uses primary blue and accent yellow.
→ Compare luminances of all pairs in your palette
→ Identify which combinations work for text and which are decoration-only
Luminance vs Other Metrics
| Metric | Range | Usage | Perceptual |
|---|---|---|---|
| Relative luminance | 0 – 1 | WCAG contrast | Yes (weighted) |
| HSL Lightness | 0% – 100% | Color adjustment | No (min/max avg) |
| HSV Value | 0% – 100% | Max saturation | No (max channel) |
| OKLCH Lightness | 0 – 1 | Modern color (CSS 4) | Yes (uniform) |