FLXCode Color Contrast Checker

FLXCode apps

Appearance

Color Contrast Checker

Pick a text color and a background. See the ratio, which WCAG levels pass, and the nearest shade that fixes a fail.

Hex, rgb(), hsl() or oklch().

Hex, rgb(), hsl() or oklch().

6.05:1

Passes AA for normal text. Fails AAA for normal text.

Result for each WCAG level
LevelNeedsResult
Normal text, AA (SC 1.4.3) 4.5:1 Pass
Large text, AA (SC 1.4.3) 3:1 Pass
Normal text, AAA (SC 1.4.6) 7:1 Fail
Large text, AAA (SC 1.4.6) 4.5:1 Pass
Interface parts and graphics (SC 1.4.11) 3:1 Pass

Ratio is cut to two decimals, never rounded up: 4.499 shows as 4.49 and fails AA. Large text is 24 px, or 18.66 px bold.

APCA (draft method, not part of WCAG 2.2): Lc 79.7 dark text on a light background.

Preview

Large text, 24 px

Bold text, 18.7 px

Normal text, 16 px. The quick brown fox jumps over the lazy dog.

Button Button border and icon are checked at 3:1.

Fix it

Nearest shades that keep the hue and change only the lightness (OKLCH). One click applies it.

Color blindness

    Simulated with the Machado, Oliveira and Fernandes (2009) matrices at full severity. The ratio is worked out on the simulated colors.

    The link carries the two colors after a # in the address. Colors are not personal data, and the part after the # is never sent to our server.

    Recent pairs

      Pairs you check are kept in this browser, up to 8.

      Check a whole palette

      Hex, rgb(), hsl(), oklch(), six-digit hex without #, or a basic name like navy. Separate them with commas, spaces or new lines.

      No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it. What this tool keeps and sends.

      Problem or idea? Email us

      How to use it

      1. Set the text color and the background color. Type a hex code, rgb(), hsl() or oklch(), use the picker, or pick from the screen where your browser can.
      2. Read the ratio and the five pass or fail lines. The preview shows the pair at normal and large size, with a button and an icon.
      3. If something fails, open Fix it. Apply the nearest lighter or darker shade, and use Undo if you do not like it.
      4. To check a design system, paste its colors into the palette box. You get every pair at once, and you can copy the matrix into a spreadsheet.

      The rule this page uses

      • Relative luminance L = 0.2126 R + 0.7152 G + 0.0722 B, with each channel made linear first (WCAG 2.2). A channel at or below 0.04045 of full scale is divided by 12.92. Above that it is ((c + 0.055) ÷ 1.055) to the power 2.4. Older texts say 0.03928. WCAG 2.2 says 0.04045, and the two give the same 8-bit results.
      • Contrast ratio = (L1 + 0.05) ÷ (L2 + 0.05), with L1 the lighter color. It runs from 1:1 to 21:1.
      • Shown with two decimals, cut and not rounded. The pass test uses the cut number.
      • Limits: Normal text, AA 4.5:1 (SC 1.4.3); Large text, AA 3:1 (SC 1.4.3); Normal text, AAA 7:1 (SC 1.4.6); Large text, AAA 4.5:1 (SC 1.4.6); Interface parts and graphics 3:1 (SC 1.4.11).
      • Fix it: the lightness of the color is moved in OKLCH in steps of 0.001, up and down, until the cut ratio passes. Hue and chroma are kept; a color sRGB cannot show loses chroma first. That search is our own method, not a standard. The result is a real shade of your color, not a grey.
      • Color blindness: the Machado, Oliveira and Fernandes (2009) matrices at severity 1.0, applied to linear RGB.
      • APCA: version 0.0.98G-4g constants, simple gamma 2.4. Draft, not part of WCAG 2.2.

      One ratio, step by step

      Take #767676 on white. Its channels are all 118, so each is 0.4627 of full scale, above 0.04045, and the linear value is ((0.4627 + 0.055) ÷ 1.055)2.4 = 0.1812. White has L = 1.

      (1 + 0.05) ÷ (0.1812 + 0.05) = 4.54:1

      That is the lightest grey that passes AA on white. One step lighter, #777777, gives 4.47:1 and fails.

      Known pairs on white

      A check you can repeat on any contrast tool. APCA is shown for text of that color on white.

      Contrast of seven colors on white, with the WCAG result and APCA Lc
      Text colorRatioAA normalAAA normalAA largeAPCA Lc
      #ffffff 1.00:1 Fail Fail Fail 0.0
      #000000 21.00:1 Pass Pass Pass 106.0
      #777777 4.47:1 Fail Fail Pass 71.1
      #767676 4.54:1 Pass Fail Pass 71.6
      #1D5FC2 6.05:1 Pass Fail Pass 79.7
      #f2b705 1.81:1 Fail Fail Fail 33.6
      #e04a2f 4.04:1 Fail Fail Pass 66.6

      Swapping the colors

      The WCAG ratio is the same either way round. #1D5FC2 on white and white on #1D5FC2 are both 6.05:1. APCA is not symmetric: it gives Lc 79.7 for the dark text and Lc -84.9 for the light text on the dark blue. The ratio does not know that light text on a dark background looks thinner and needs more room. A future version of WCAG may use a different method.

      See-through colors

      Black text at 50% opacity on white does not have the ratio of black on white. It is blended first: 0.5 × 0 + 0.5 × 255 = 127.5, which becomes 128 in 8 bits, so the text is #808080. The ratio is 3.94:1, a fail for normal text.

      Different hue, similar lightness

      A red #d12b2b and a green #2b8a3e are different colors to most people. Seen with deuteranopia they become #897a23 and #807644. Their ratio is 1.17:1 for typical vision and 1.06:1 as simulated. Check pairs like this in the color blindness row, and do not carry meaning with color alone.

      Limits

      • It measures two flat colors. Text on a photo, a gradient or a pattern needs a check on the worst spot.
      • Thin fonts, small sizes, glare and dark mode comfort are not in the WCAG ratio. A pass is the minimum, not a design review.
      • The color blindness view is a simulation of the full forms. Partial forms (anomalies) are milder, and people differ.
      • Your screen, its brightness and its color profile change how a color looks. The ratio works from the hex values, not from what your screen shows.
      • Basic color names only (black, white, red, navy and about 20 more). For any other color use its hex code.
      • EyeDropper (Pick from screen) works in Chromium browsers such as Chrome and Edge. Elsewhere the button is hidden.

      Nothing you enter is uploaded. We count events without cookies, such as how a color was set, never the color (details). Related: Color Palette Generator and Color Picker from Image.

      FAQ

      What contrast ratio do I need?

      For WCAG 2.2 level AA, 4.5:1 for normal text and 3:1 for large text, and 3:1 for the borders and icons of controls. For level AAA, 7:1 for normal text and 4.5:1 for large text. The table under the ratio shows each of the five tests as pass or fail.

      What counts as large text?

      Text of at least 18 point, or 14 point and bold. On a screen that is 24 px, or about 18.66 px bold. The preview shows both sizes so you can see them.

      Why is 4.499 not shown as 4.50?

      The ratio is cut to two decimals, not rounded, and the pass test uses the cut value. So 4.499 shows as 4.49 and fails AA. If it were rounded up, a page could read 4.50 and fail, or claim a pass it does not have. #777777 on white is 4.47 and fails. #767676 is 4.54 and passes.

      How does it handle see-through colors?

      Text with less than 100% opacity is blended over the background first, and the blended color is what gets measured. A background with less than 100% opacity is blended over white, the page. The note under the result says so and shows the blended hex code. Colors are rounded to 8 bits per channel after blending, as a screen does.

      Is APCA part of WCAG?

      No. APCA (Lc, lightness contrast) is a draft method for a future version of WCAG. WCAG 2.2 uses the ratio. Lc depends on which color is the text, so the same pair gives different numbers swapped, and the sign tells you the direction. The page shows it as extra information only. Do not use it for a WCAG claim.

      Does a good ratio help with color blindness?

      A ratio is about light and dark. It helps, because most color blind people see lightness well. It does not help when two colors differ only in hue, like a red and a green of the same lightness. The preview shows your pair as three kinds of color blindness see it, with the ratio of the changed colors.

      More from FLXCode

      • Color Palette GeneratorMake 5 colors from a base: complementary, analogous, triadic, tetradic or monochrome. Lock, check contrast, export.
      • Color Picker from ImageClick a picture to get the HEX, RGB, HSL, HSV and CMYK of any pixel, plus its dominant colors. Nothing is uploaded.
      • Change Image ColorSwap one colour in a picture, or shift the colours of the whole thing. Nothing is uploaded.
      • Make Background TransparentMake a plain white or coloured background see-through and save a PNG. Nothing is uploaded.

      Share Color Contrast Checker