Relative Luminance (WCAG) Calculator

Relative luminance is the number that drives accessible color contrast on the web. It measures how bright a color appears on a scale from 0 for black to 1 for white, weighting the three channels by how strongly the eye responds to each. This calculator follows the WCAG definition exactly. First it converts each channel from its 0 to 255 value to a 0 to 1 fraction. Then it linearizes that fraction, because screen values are gamma-encoded rather than proportional to actual light: small values are divided by 12.92, and larger values use the curve ((c + 0.055) divided by 1.055) raised to the power 2.4. Finally it combines the linear channels as 0.2126 times red plus 0.7152 times green plus 0.0722 times blue, coefficients that give green the most weight and blue the least, summing to 1 so white returns exactly 1. The result feeds the WCAG contrast ratio used to judge whether text is readable against its background. Enter any red, green and blue values and the page returns the linearized channels and the final luminance. Every figure is computed deterministically from the official formula, never estimated, with the method and a worked example shown below for verification.

Relative luminance is the weighted sum of linearized channels: L = 0.2126R + 0.7152G + 0.0722B. A mid gray of (128, 128, 128) has a relative luminance of 0.2159 on the 0 to 1 scale.

Source: US National Institute of Standards and Technology (NIST). As at 25 June 2026.

Linear red--
Linear green--
Linear blue--
Relative luminance--

Relative luminance formula

For each channel c in {R, G, B}: let s = channel / 255
linear = s / 12.92 if s <= 0.03928, else ((s + 0.055) / 1.055)^2.4
L = 0.2126 x linearR + 0.7152 x linearG + 0.0722 x linearB
L ranges from 0 (black) to 1 (white)

The linearization undoes the sRGB gamma so the channels represent actual light. The weights reflect the eye's sensitivity, with green dominant and blue least.

Worked example

Find the relative luminance of mid gray, red 128, green 128 and blue 128.

  1. Each channel: s = 128 / 255 = 0.50196
  2. Above 0.03928, so linear = ((0.50196 + 0.055) / 1.055)^2.4 = 0.21586
  3. All three channels equal 0.21586
  4. L = (0.2126 + 0.7152 + 0.0722) x 0.21586 = 1 x 0.21586
  5. L = 0.2159 (rounded to 4 places)

Mid gray has a relative luminance of 0.2159. These are the calculator's default inputs, so the result above matches the widget exactly.

Luminance of reference colors

Pure white is 1 and black is 0; primaries reflect the channel weights.

ColorRelative luminance
White (255, 255, 255)1.0000
Green (0, 255, 0)0.7152
Red (255, 0, 0)0.2126
Blue (0, 0, 255)0.0722
Black (0, 0, 0)0.0000

Color, light measurement and digital representation: US National Institute of Standards and Technology (NIST).

Relative luminance calculator: frequently asked questions

What is relative luminance?

Relative luminance is the perceived brightness of a color on a scale from 0 for black to 1 for white. The WCAG definition weights the three color channels by how strongly the human eye responds to each: green contributes most, red next and blue least, after each channel is linearized from its sRGB value.

Why are the channels linearized first?

Screen color values are gamma-encoded, not linear with light intensity. Before weighting, each channel divided by 255 is converted to linear light: values at or below 0.03928 are divided by 12.92, and higher values use ((c + 0.055) / 1.055) raised to the power 2.4. This makes the luminance match real light output.

What are the channel weights?

The linear channels are combined as 0.2126 times red plus 0.7152 times green plus 0.0722 times blue. These coefficients reflect the eye's greater sensitivity to green light and weaker sensitivity to blue, and they sum to 1 so pure white gives a luminance of exactly 1.

What is relative luminance used for?

It is the basis of the WCAG contrast ratio, which compares the luminance of text and its background to judge readability. Luminance on its own is also useful for sorting colors by brightness or choosing a readable foreground.

Is the result computed automatically?

Yes. The page linearizes each channel and applies the weighted sum deterministically. No value is estimated or hard-coded, so changing any channel updates the luminance instantly.

Official sources

Reviewed by the CalculatorHub team, edited by James Graham, 25 June 2026. See our methodology. This is general information, not financial, tax, legal or investment advice.