Skip to content

Color Luminance Calculator

Calculate color luminance, brightness and WCAG contrast ratios from HEX or RGB values. Free and no signup.

  • 100% free
  • No Signup
  • WCAG 2.x formula

Results

Sample heading The quick brown fox jumps over the lazy dog.
Relative luminance00 (black) to 1 (white)
Luminance percent0%Share of maximum brightness
Perceived brightness00 to 255 (W3C formula)
HSL lightness0%Not the same as luminance
Light or dark--
Best text color--
Contrast ratio (your color vs compare color)
0: 1
vs white 0:1 vs black 0:1
AA normal text4.5 : 1
AA large text3 : 1
AAA normal text7 : 1
AAA large text4.5 : 1
UI components3 : 1
How the luminance was calculated
ChannelsRGB (0-255)NormalizedLinearWeightContribution
ADVERTISEMENT
Demo Ad 728 x 90 320 x 100

How to calculate color luminance

  1. 1

    Enter a color

    Pick a color or type a HEX or RGB value.

  2. 2

    Add a text color

    Choose a second color to compare and check the contrast ratio.

  3. 3

    Read the results

    See the luminance, brightness and WCAG AA and AAA results instantly.

COLOR LUMINANCE GUIDE

Color Luminance Calculator – Find the Relative Luminance and Brightness of Any Color Online

How bright is a color really? Two colors can have the same lightness on paper and still look completely different to the human eye, which is why designers, developers and accessibility testers rely on a color luminance calculator instead of guessing. Our free color luminance calculator takes any HEX or RGB color and instantly returns its relative luminance using the official WCAG formula, along with the perceived brightness, the HSL lightness, a clear light or dark verdict, the best text color to use on top of it and the full contrast ratio against a second color. It works as a relative luminance calculator, a color brightness calculator, a HEX to luminance converter, an RGB to luminance calculator and a WCAG contrast checker in one simple page. There is no signup, nothing to install and no data is sent to a server, because every calculation happens directly in your browser on your phone, tablet or computer.

Relative Luminance Calculator

Get the exact relative luminance of a color on the standard scale from 0 for pure black to 1 for pure white. The result follows the WCAG 2.x definition, with sRGB gamma correction applied to every channel, so you can use the number directly in accessibility reports and design documentation.

WCAG Contrast Ratio Checker

Compare your color with any text or background color and see the contrast ratio with pass or fail results for AA and AAA, for normal text, large text and user interface components. It is a quick way to check whether a color combination is readable.

Color Brightness Calculator

See the perceived brightness of any color on a 0 to 255 scale and find out whether it reads as light or dark. The tool also recommends black or white text, so you can choose a readable label color for buttons, tags, charts and badges in seconds.

What Is Color Luminance and Why Does It Matter?

Luminance is a measure of how much light a color appears to emit or reflect to the human eye. It is different from the numbers you see in a color picker, because the eye does not respond to red, green and blue equally. We are far more sensitive to green light than to red, and far more sensitive to red than to blue. That is why a pure green and a pure blue with exactly the same RGB intensity look so different: the green appears bright and the blue appears dark. Relative luminance captures this behavior in a single number between 0 and 1, where 0 is the darkest possible black and 1 is the brightest possible white.

This number matters because it is the foundation of readable design. When text and background have a big difference in luminance, people can read comfortably, including people with low vision, color blindness, tired eyes or a phone screen in bright sunlight. When the difference is small, text blurs into the background no matter how nice the colors look side by side. Luminance is also the base of the contrast ratio, the metric that accessibility laws and standards use to decide whether a design is acceptable.

How to Calculate the Luminance of a Color (Step by Step)

You can use the calculator above to get the result instantly, but it helps to understand what happens behind the scenes. The WCAG relative luminance formula has three clear steps, and the breakdown table in the results shows each one for your color.

  1. Normalize each channel: Divide the red, green and blue values by 255 so that every channel is a number between 0 and 1.
  2. Remove the sRGB gamma curve: If the normalized value is 0.03928 or lower, divide it by 12.92. Otherwise add 0.055, divide by 1.055 and raise the result to the power of 2.4. This converts the screen value into a linear light value.
  3. Apply the weights: Calculate L = 0.2126 × R + 0.7152 × G + 0.0722 × B, using the linear values. The weights reflect how strongly the eye reacts to each color.

The final L is your relative luminance. For example, pure white gives 1, pure black gives 0, a mid gray such as #808080 gives about 0.216, and pure blue gives only 0.0722, which is why blue text on a black background is so hard to read.

Relative Luminance Examples for Common Colors

The table below lists the relative luminance of well-known colors. Notice that the numbers are not evenly spread. Yellow is almost as luminous as white, while blue and red are surprisingly dark, and a medium gray has a luminance of only around 0.22 even though its RGB value sits at the middle of the scale.

Relative luminance of common colors
Color HEX Relative luminance Best text color
White#ffffff1.0000Black
Yellow#ffff000.9278Black
Cyan#00ffff0.7874Black
Green#00ff000.7152Black
Magenta#ff00ff0.2848Black
Medium gray#8080800.2159Black
Red#ff00000.2126Black
Blue#0000ff0.0722White
Black#0000000.0000White

Luminance vs Luma vs Lightness vs Brightness: What Is the Difference?

These four words are often used as if they mean the same thing, but they describe different calculations, and mixing them up is one of the most common mistakes in color work. Relative luminance is the physically based value that uses linear light and is the one used by WCAG. Luma is a quicker approximation that applies the weights directly to the gamma-encoded RGB values, as used in video and in the classic W3C brightness formula. HSL lightness is simply the average of the largest and smallest channel, and it ignores how the eye actually perceives color, so a pure yellow and a pure blue both have 50 percent lightness even though one is extremely bright and the other is dark. Perceived brightness is the general idea of how bright a color looks to a person.

Luminance, luma, lightness and brightness compared
Term How it is calculated Best used for
Relative luminanceGamma-corrected linear RGB with weights 0.2126, 0.7152 and 0.0722WCAG contrast ratio and accessibility testing
LumaWeights applied to gamma-encoded RGB valuesVideo, image processing and fast approximations
Perceived brightness(299 × R + 587 × G + 114 × B) / 1000Quickly choosing light or dark text on a color
HSL lightnessAverage of the highest and lowest RGB channelBuilding color scales and tints in CSS

Understanding the WCAG Contrast Ratio Formula

Once you know the luminance of two colors, the contrast ratio is easy to calculate. Add 0.05 to the luminance of the lighter color, add 0.05 to the luminance of the darker color, and divide the first number by the second. The 0.05 value is there to account for ambient light and screen glare. The result runs from 1 to 1 for two identical colors up to 21 to 1 for black on white, which is the highest contrast possible on a screen. This is the number you see when a designer says a button has a ratio of 4.6 to 1 or when an audit tool reports that a heading fails with 2.8 to 1.

This calculator does the whole process for you. The color you enter is treated as the background and the compare color as the text, but because the ratio is symmetrical you get the same number if you swap them. Use the Swap colors button to check how a color pair feels in both directions, and watch the sample text in the preview to confirm that the numbers match what you actually see.

WCAG AA and AAA Contrast Requirements Explained

The Web Content Accessibility Guidelines define two conformance levels for text contrast. Level AA is the standard target for most websites and apps and is the level referenced by many accessibility laws, while Level AAA is the enhanced level for content that needs the best possible readability. Large text, defined as 24 pixels regular or about 18.66 pixels bold and above, needs less contrast because bigger letters are easier to recognize. Graphical objects and user interface components such as input borders, icons and chart lines need a ratio of at least 3 to 1 under WCAG 2.1.

WCAG contrast ratio requirements
Content type Level AA Level AAA
Normal text4.5 : 17 : 1
Large text3 : 14.5 : 1
UI components and graphics3 : 1Not defined
Logos and decorative textExemptExempt

Passing a check in the results panel is a strong sign that your color pair is readable, but remember that accessibility also depends on font weight, size, spacing and the device your visitors use. Treat the ratio as a minimum, and aim higher whenever the design allows it.

How to Choose Black or White Text on Any Background Color

One of the most useful applications of luminance is picking a readable label color automatically. If you compare the contrast of black text and white text against a background, there is a tipping point at a relative luminance of about 0.179. Above that value black text gives the higher contrast, and below it white text wins. That is exactly what the Best text color result in this tool reports, so you do not have to rely on the simple but often misleading rule of choosing white text for anything that looks dark.

This is especially helpful for dynamic interfaces, such as tags and avatars that get their color from user data, charts with automatically generated series colors, theme builders and color palettes. Developers can implement the same check in a few lines of code, and designers can use the calculator to double-check the result for any color before it ships.

Practical Uses of a Color Luminance Calculator

  • Web accessibility audits: Test text, buttons, links and form fields against WCAG AA and AAA before a site goes live.
  • UI and brand design: Check that a brand color works for buttons and headings, and find which shades are light enough to carry dark text.
  • Dark mode design: Compare surface colors and text colors to keep layers distinct without eye strain.
  • Data visualization: Make sure chart series and map colors are distinguishable by brightness, not only by hue, so they still work for color-blind viewers and in grayscale prints.
  • Print and presentation design: Predict how colors behave in black and white and on projectors with low contrast.
  • Front-end development: Verify the output of color functions, tokens and Tailwind or CSS variable palettes.
  • Teaching and learning: Use the step-by-step table to learn how gamma correction and the luminance weights actually work.

Tips for Better Contrast and More Readable Colors

  • Judge by luminance, not hue: Colors that look different can have nearly identical luminance, which makes them hard to separate for many viewers.
  • Avoid pure red or blue for small text: Their low luminance makes them tiring to read on dark backgrounds.
  • Use darker shades for links on white: A link at a 600 or 700 shade usually clears 4.5 to 1, while a 400 shade often does not.
  • Test hover, focus and disabled states: These states are often forgotten and frequently fail contrast checks.
  • Check text over images and gradients: Test the lightest and darkest parts of the background behind the text.
  • Do not rely on color alone: Add icons, underlines or labels so information is clear even when colors are hard to tell apart.

Color Luminance Chart From Dark to Light

This chart lists the WCAG relative luminance of common colors on a scale from 0 for black to 1 for white. It also shows the contrast ratio of each color with white.

Relative luminance values of common colors
ColorHEXRelative luminanceContrast with white
Black#0000000.00021.00:1
Navy#0000800.01616.00:1
Blue#0000FF0.0728.59:1
Green#0080000.1545.13:1
Red#FF00000.2133.99:1
Gray#8080800.2163.94:1
Orange#FFA5000.4821.97:1
Lime#00FF000.7151.37:1
Yellow#FFFF000.9281.07:1
White#FFFFFF1.0001.00:1

How to Calculate Relative Luminance by Hand

Here is the calculation for #336699. Divide the channels 51, 102 and 153 by 255 to get 0.2, 0.4 and 0.6. Convert each to a linear value with the sRGB formula: for values above the small threshold, compute ((c + 0.055) / 1.055) ^ 2.4. The results are about 0.033 for red, 0.133 for green and 0.319 for blue. Multiply them by 0.2126, 0.7152 and 0.0722 and add the products. The luminance is about 0.125.

Relative Luminance Formula in JavaScript

First convert one channel with const lin = v => { v /= 255; return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4; };. Then calculate 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b). You may see 0.03928 used as the threshold in WCAG related code, while the sRGB standard uses 0.04045. For 8 bit color values both give the same results.

Why Luminance Is Not the Same as Opacity or Lightness

Luminance describes the light of a solid color. A semi-transparent color has no single luminance until you know what is behind it, so first work out the visible blended color and then measure that. HSL lightness is also a different number: pure blue and pure yellow share 50% HSL lightness, yet their relative luminance values are far apart.

Using Luminance to Order Colors in Charts and Themes

Sorting a palette by luminance shows its range from dark to light, which helps when you build a sequential chart or a theme scale. If two data colors have nearly the same luminance, they may be hard to separate in grayscale printing. Change one of them, and add labels or patterns so that meaning does not rest on color alone. You can preview this problem with the Color Blindness Simulator.

Related Brightness and Contrast Tools

For perceived brightness scores use the Color Brightness Calculator. To test a text and background pair in detail, open the Color Contrast Ratio Calculator, or let the Text Color Selector suggest a readable text color.

Free Online Luminance and Contrast Tool for Designers and Developers

Whether you need a quick HEX to luminance conversion, an RGB to relative luminance calculation for a script, a color brightness check for a poster or a full WCAG contrast check for a website, this calculator gives you accurate results without friction. It supports HEX and RGB input, shows the math step by step, works on every modern browser and device, and never stores your colors. Bookmark it for your next design review, accessibility audit or code review.

Ready to test a color? Scroll up, enter your HEX or RGB value, choose a text color to compare and read the results. If you are building color palettes or gradients, explore the other free color tools on our site as well.

ADVERTISEMENT
Demo Ad 300 x 250 300 x 250
COMMON QUESTIONS

Color Luminance Calculator FAQ

Quick answers about relative luminance, brightness, contrast ratio and WCAG color accessibility.

How do I calculate the luminance of a color?

Enter a HEX or RGB value in the calculator and the relative luminance appears instantly. To do it by hand, normalize each channel, remove the sRGB gamma curve, and combine the linear values with the weights 0.2126 for red, 0.7152 for green and 0.0722 for blue.

What is relative luminance?

Relative luminance is the brightness of a color as the human eye perceives it, expressed as a number from 0 for black to 1 for white. It is the value used by the WCAG standard to calculate contrast ratios.

What is the difference between luminance and brightness?

Luminance uses gamma-corrected linear light and follows the WCAG definition, while perceived brightness in this tool uses a simpler weighted average of the RGB values on a 0 to 255 scale. Both describe how light a color looks, but luminance is the correct one for accessibility and contrast calculations.

What contrast ratio do I need to pass WCAG AA and AAA?

For normal text, AA needs at least 4.5 to 1 and AAA needs 7 to 1. For large text, AA needs 3 to 1 and AAA needs 4.5 to 1. User interface components and graphics need 3 to 1 under WCAG 2.1.

Should I use black or white text on my color?

Check the Best text color result. If the relative luminance of your background is above about 0.179, black text has higher contrast. Below that value, white text is the better choice.

Why do two colors with the same HSL lightness look different in brightness?

HSL lightness ignores how the eye responds to each color. Yellow and blue can both have 50 percent lightness, but yellow has a far higher luminance. That is why contrast should always be checked with luminance rather than HSL values.

Is my color data stored or sent anywhere?

No. The calculator runs completely in your browser, so your colors are not uploaded or stored on our servers, and no account is needed.

ADVERTISEMENT
Demo Ad 728 x 90 320 x 100