Luminance Calculator

Read the relative luminance of a color.

Use this tool

Result

The result appears in this panel after you run the tool.

About this tool

The number is the WCAG relative luminance from 0 to 1.

It is not a lightness percentage and it is not a contrast ratio by itself.

How to use it

  1. Open this page and provide the input it asks for.
  2. Set the options that are visible, then use Calculate luminance.
  3. Read the result in the panel. Copy it or download it when a file is offered. The input stays in this browser.

Limitations

Transfer function first, then the three weights

The formula on the hex you typed

The color is hex, expanded to six digits if you typed three. Relative luminance divides each channel by 255. If that unit value is at or below 0.04045, it is divided by 12.92. Otherwise 0.055 is added, the sum is divided by 1.055, and the quotient is raised to 2.4. Those three linearized channels are weighted 0.2126 for red, 0.7152 for green, and 0.0722 for blue, and the weighted sum is the result. The page prints it with four decimal places and labels it as sRGB relative luminance in the WCAG sense.

That is not the average of the three encoded channels, and it is not the average of the three unit channels before the transfer. Green dominates because of the 0.7152 weight. A pure green is far lighter than a pure blue under this sum. Pure white is 1. Pure black is 0. A mid gray at 128 on each channel is not 0.5, because the transfer is curved. If you needed 0.5 you would have to search for the encoded gray that linearizes to that luminance. This page does not search. It evaluates the color you gave.

What the number is for, and what it ignores

The figure is the Y that the contrast ratio consumes. Contrast still needs a second color, then (lighter + 0.05) / (darker + 0.05). This page stops after one luminance. Pair the two luminances yourself only if you are comfortable doing that last step. Otherwise open the contrast page and let it apply the thresholds.

The calculation assumes the hex is sRGB. It does not read a display profile, a brightness setting, or an ambient light. Two monitors can show the same hex at different physical luminances while this number stays fixed. Print is not involved. Reflectance of ink is a different quantity from relative luminance of an sRGB code. A CMYK conversion will not reproduce this Y by itself. A spec that asks for WCAG relative luminance of an sRGB color can take this figure. A light meter is a different instrument, and the figure will not stand in for one. The swatch is the color under test. Alpha is not accepted. A translucent hex is outside the parser, which wants an opaque six-digit form after expansion.

Privacy

Your input is processed in your browser and is not uploaded to UtilChain. File names, text, and results are not sent to analytics.