Cognitive Sciences Stack Exchange is a question and answer site for practitioners, researchers, and students in cognitive science, psychology, neuroscience, and psychiatry. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The Word Wide Web Consortium (W3C) has a formula for the contrast ratio of any two arbitrary colors, which they use to set minimum standards for text legibility:

Step 1 of the process is relatively straight-forward - it uses a well known conversion from sRGB to XYZ and keeps the Y component for the next step. Step 2 is the same for the second color.

My question comes in step 3, where the ratio is determined as (L1 + 0.05) / (L2 + 0.05) with L1 and L2 being the luminances of the lighter and darker colors from steps 1 and 2. Where does the magic constant 0.05 come from? It's obvious that some constant offset is needed, otherwise pure black would have infinite contrast against every other color. But how is it derived?

Also, does this contrast ratio reasonably describe how easy it is to discern text against a background? Or is there a different formula that would be better?

I ask because it seems to favor black over white - where I see better results with white text, the formula suggests black is better. I'd like a clearer understanding.

share|improve this question
I came across this today which at least gives sources for the formulas:…. I haven't yet poked through the links to study the rationale. – Mark Ransom Apr 21 at 20:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.