Calculators

Color Contrast Ratio Calculator

Calculate the ordered contrast ratio from two precomputed relative luminance values between0and1. Either value may be lighter. This does not convert hex/RGB colors or establish whole-page accessibility conformance.

Loading calculator...

What the Color Contrast Ratio Calculator does

The Color Contrast Ratio Calculator compares two precomputed relative luminance values and reports their contrast ratio in a form such as 21:1. Relative luminance describes the perceived brightness of a color on a scale from 0 to 1. The calculator accepts two numeric values on that scale, identifies which is lighter, and applies the contrast ratio formula.

This tool is intended for a narrow, transparent calculation. It does not accept hexadecimal or RGB color codes, convert colors into luminance, inspect an illustration, or evaluate an entire page. You must obtain the relative luminance values elsewhere before entering them. The result is a pairwise ratio for those supplied values. It does not establish that a design, page, or digital product conforms to accessibility requirements.

For artists and illustrators, a pairwise comparison can help assess the brightness separation between two selected colors in a palette, lettering treatment, interface mockup, or graphic. The ratio can inform a design review, while the broader context still matters, including text size, visual presentation, and how the work is used.

How to use the Color Contrast Ratio Calculator

Enter the relative luminance of each color into the corresponding field. Both inputs must be numbers from 0 through 1. Use a value calculated or supplied by a trusted color analysis process. Do not enter a hexadecimal string, RGB triplet, percentage, or contrast ratio in place of a luminance value.

  1. Find the precomputed relative luminance for the first color and enter it in the first field.
  2. Find the precomputed relative luminance for the second color and enter it in the second field.
  3. Read the displayed ratio, which is rounded to two decimal places and followed by “:1”.
  4. Keep track of which colors you compared so the result remains useful when revisiting a palette or artwork.

The field names identify entry order only. Either value may represent the lighter color. The calculation handles that by using the absolute difference between the two luminances. You do not need to rearrange the inputs before calculating.

The configured defaults are luminance 1 and luminance 0. With those defaults, the displayed result is 21:1. This is a verified endpoint example for understanding the calculator’s output format. Replace the defaults with the precomputed values for the colors you actually want to compare.

How the Color Contrast Ratio Calculator formula works

The calculator uses the standard contrast ratio structure based on the lighter and darker relative luminance values. It adds 0.05 to each luminance, then divides the adjusted lighter value by the adjusted darker value. In the supplied formula, the square root of the squared difference between the two inputs identifies the size of their separation regardless of their order.

In symbolic terms, the formula is (lighter luminance + 0.05) divided by (darker luminance + 0.05). The given implementation expresses the lighter and darker values using the two input numbers and their absolute difference. The output is a ratio, so it has no physical unit. The input values are relative luminance values on the 0 to 1 scale.

For a worked example, enter luminance 0.82 and luminance 0.16. Their difference is 0.66, so the lighter value is 0.82 and the darker value is 0.16. Applying the formula gives (0.82+0.05)/(0.16+0.05)=0.87/0.21=4.142857142857... before rounding. The calculator displays 4.14:1. This result is below 4.5. The comparison describes only those two supplied luminance values.

When the two luminances are equal at 0.5 and 0.5, the formula gives 1:1. That illustrates that equal brightness produces the minimum ratio in this calculation. It does not mean the colors are identical, because different hues can have the same relative luminance.

Use cases for the Color Contrast Ratio Calculator

Artists, illustrators, and designers can use a pairwise ratio as one small check during color decisions. For example, a creator might compare the luminance of lettering and a background, or examine whether two neighboring shapes have a strong brightness distinction. The numeric result can make a comparison easier to record and repeat as a palette changes.

  • Palette exploration: compare selected colors after their luminance values have been computed.
  • Graphic and poster review: check the brightness relationship between a text color and its immediate background.
  • Iteration notes: record a pairwise ratio alongside color names or swatches while revising artwork.
  • Team discussion: use a shared numeric comparison to clarify which two colors a design review is discussing.

These uses support a focused comparison. They do not replace viewing the work in context or checking relevant accessibility guidance. A ratio alone cannot account for every aspect of an image, typography, or user experience.

Other factors to consider when calculating a color contrast ratio

The accuracy of the result depends on the inputs. A calculator can apply the formula consistently, but it cannot verify whether supplied luminance numbers were derived correctly. Confirm that both values represent relative luminance on the intended 0 to 1 scale. If a source uses a different scale or provides encoded color-channel values, those figures are not ready for direct entry.

Consider the design context as well. The ratio compares two colors, while an illustration or interface may have gradients, transparency, textured surfaces, outlines, changing backgrounds, or multiple visual states. A single pair of values may not represent all those conditions. Text presentation and applicable evaluation criteria also affect accessibility assessment.

Use the result as one measurement in a broader review. The calculator does not convert colors, inspect image files, judge legibility, or certify whole-page conformance. For authoritative guidance on contrast minimum criteria, consult the W3C reference linked below.

Frequently asked questions

What does relative luminance mean?

Relative luminance is a normalized measure of the brightness of a color, represented here as a number from 0 to 1. This calculator assumes you have already obtained that value for each color.

Can I enter a hex code or RGB color?

No. The inputs accept numbers only. Convert or otherwise determine each color’s relative luminance using an appropriate method before using this calculator.

Does the calculator decide which input is lighter?

Yes. Its formula uses the difference between the inputs to account for their order, so either field can contain the lighter luminance.

Does a displayed ratio prove that my page meets accessibility requirements?

No. The result compares only two supplied luminance values. It does not evaluate a whole page, confirm the inputs, or establish conformance.

Why can two different colors have a 1:1 ratio?

A 1:1 ratio means the two entered luminance values are equal. Colors can differ in hue or saturation while sharing the same relative luminance, so equal ratios do not necessarily mean the colors look alike.

Official source: W3C Understanding Success Criterion 1.4.3: Contrast (Minimum).

Written by

gunkiss.com Editorial Team

Editorial team

Independent editorial coverage of illustration & creative practice.