Home › Image Tools › Color Contrast Checker

Color Contrast Checker

Pick a text color and a background to get the exact WCAG 2 contrast ratio with pass or fail results for AA, AAA and UI graphics. If a pair fails, the tool suggests the closest color that passes.

Last updated:

Text color (foreground)
Background color

Backgrounds are treated as solid (opaque) colors.

Contrast ratio
4.47:1

Live preview

Normal text (16px): The quick brown fox jumps over the lazy dog. Body copy like this needs a ratio of at least 4.5:1.

Large text (24px)

Bold large text (18.66px bold)

Button label A text link Outline button

Suggest nearest passing color

Keeps the hue and saturation and changes only lightness, by the smallest amount needed.

Advertisement
Advertisement

How to use the Color Contrast Checker

  1. Choose the text color with the picker or type a HEX, RGB or HSL value.
  2. Choose the background color the same way. Use Swap to flip the two.
  3. Read the contrast ratio and the pass or fail badges for AA, AAA and UI components.
  4. Check the live preview to see body text, large text, a button, a link and icons.
  5. Fix a failing pair: press Apply on a suggested text or background color that passes AA or AAA.
  6. Copy the result or the share link to send the exact colors to a teammate.

WCAG contrast requirements at a glance

CriterionApplies toMinimum ratio
1.4.3 Contrast (Minimum), AANormal text4.5:1
1.4.3 Contrast (Minimum), AALarge text (24px, or 18.66px bold)3:1
1.4.6 Contrast (Enhanced), AAANormal text7:1
1.4.6 Contrast (Enhanced), AAALarge text4.5:1
1.4.11 Non-text Contrast, AAIcons, form field borders, focus rings, chart lines3:1

Logos, purely decorative images and disabled controls are exempt. Text that is part of a photo still counts if it carries information.

The formula, step by step

For each color, divide the red, green and blue values by 255. Linearize every channel: if the value is 0.04045 or less, divide it by 12.92; otherwise compute ((value + 0.055) / 1.055) raised to the power 2.4. Then combine them into relative luminance:

L = 0.2126 × R + 0.7152 × G + 0.0722 × B

The contrast ratio is (L1 + 0.05) / (L2 + 0.05), with L1 the lighter of the two colors. White has L = 1 and black has L = 0, so black on white gives (1.05 / 0.05) = 21:1, the maximum. Green dominates the formula because the eye is most sensitive to it, which is why pure green (#00ff00) is much "lighter" than pure blue (#0000ff).

Worked examples

TextBackgroundRatioResult
#000000#ffffff21:1Passes everything
#595959#ffffff7.0:1Passes AAA normal text
#767676#ffffff4.54:1Passes AA normal text
#777777#ffffff4.48:1Fails AA normal, passes AA large
#ffffff#0000ff8.59:1Passes AAA
#ffffff#ff00004.0:1Large text and UI only
#ffffff#00ff001.37:1Fails everything

Tips for accessible color pairs

  • Change lightness, not hue. Contrast depends almost only on luminance. Darkening a brand color a few steps usually keeps it recognizable while passing AA.
  • Check every state. Hover, focus, visited links, placeholder text and error messages need their own checks.
  • Test text on images against the lightest and darkest areas behind it, or add a solid or semi-opaque backdrop.
  • Do not rely on color alone to convey meaning. Pair colored states with text, icons or underlines (SC 1.4.1).

Need colors that pass from the start? Pick your brand hue first, then use the suggestions above to find the lightest shade that reaches 4.5:1 on white for body text and a darker shade that reaches 7:1 for long-form reading.

Frequently asked questions

What contrast ratio does WCAG require?

WCAG 2 level AA requires at least 4.5:1 for normal text and 3:1 for large text. Level AAA requires 7:1 for normal text and 4.5:1 for large text. User interface components and meaningful graphics such as icons, input borders and focus indicators need at least 3:1 against adjacent colors.

What counts as large text?

Large text is at least 18 point (24 CSS pixels) in regular weight, or at least 14 point (about 18.66 CSS pixels) in bold. Anything smaller is normal text and needs the stricter ratio.

Why does #777777 on white fail AA?

Its contrast ratio is about 4.48:1, which this tool shows as 4.47 because WCAG thresholds are strict and values are never rounded up. 4.48 is below 4.5, so it fails for normal text. #767676 is the lightest gray that passes on white, at about 4.54:1.

How is the contrast ratio calculated?

Each color is converted to relative luminance: the sRGB channels are linearized and weighted 0.2126 for red, 0.7152 for green and 0.0722 for blue. The ratio is (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter color. It ranges from 1:1 for identical colors to 21:1 for black on white.

How does text opacity affect contrast?

Semi-transparent text is mixed with the background behind it, so its visible color is lighter or darker than the original. The tool blends the text color over the background at the chosen opacity and measures that rendered color, which is what users actually see.

Does passing WCAG contrast guarantee readable text?

It is a minimum, not a guarantee. Very thin fonts, small sizes, busy background images and some color vision deficiencies can still make text hard to read. Aim higher than the minimum for long body text where you can.

Is the newer APCA method used here?

No. This tool uses the WCAG 2.x contrast formula, which is the one referenced by current laws and standards such as WCAG 2.1 and 2.2, EN 301 549 and Section 508. APCA is a proposed method for a future WCAG version and gives different numbers.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Color Palette GeneratorGenerate beautiful color palettes and export them.HEX to RGBConvert HEX colors to RGB and other formats.RGB to HEXConvert RGB to HEX with sliders, live swatch and one-click copy.Color Name FinderFind the closest color name for any HEX or RGB color.Browser Compatibility CheckerSearch CSS, JavaScript and HTML features and see which browser versions support them.Color Blindness SimulatorSee any image as people with protanopia, deuteranopia, tritanopia or achromatopsia see itColor Blindness TestQuick 14-plate dot test that screens for red-green and blue-yellow color vision deficiency.Color Perception TestFind the one tile with a different shade. The grid grows and colors get closer each level.HEX to HSLConvert HEX colors to HSL and back with interactive sliders.RGB to CMYK ConverterConvert RGB and HEX colors to CMYK for print, and back.Pantone to HEXLook up approximate HEX, RGB and CMYK values for Pantone colors.Image Color PickerPick any pixel colour from an image and get HEX, RGB, HSL plus a paletteTailwind Color GeneratorTurn one color into a full Tailwind 50–950 shade scale and export the config or CSS.Color MixerMix two colors in sRGB, linear, OKLab or OKLCH, or blend them with Photoshop-style modes.Random Color GeneratorGenerate random HEX colors one at a time or in batches, with hue, saturation and lightness ranges.Color PickerPick any color and get HEX, RGB, HSL, HSV and CMYK codes, shades and a screen eyedropper.HTML Color CodesAll 140 HTML color names with HEX and RGB codes, plus the 216 web-safe colors. Click to copy.Color Palette from ImageExtract the main colors of any photo as HEX codes, CSS variables and a palette PNG.Replace Color in ImageClick a color in a picture and swap it for a new color or transparency, keeping the shading.CMYK to RGBConvert CMYK percentages to RGB and HEX color codes with sliders and a live preview.HSL to HEXConvert HSL and HSLA colors to HEX and RGB with sliders and a live preview.HEX to RGBAConvert HEX color codes to CSS rgba() with an opacity slider and one-click copy.RGBA to HEXConvert rgba() colors to 8-digit HEX, or flatten transparency onto any background.HEX to CMYKConvert HEX color codes to CMYK percentages for print, with a live preview.HEX to PantoneFind the 5 closest Pantone-style solid coated colors for any HEX or RGB, ranked by Delta E.Color Temperature to RGBConvert a color temperature in kelvin (1000-40000 K) to RGB and HEX with a live swatch.OKLCH Color ConverterConvert HEX, RGB and HSL to OKLCH, OKLab, Lab and LCH with sRGB and P3 gamut checks.RAL to HEXLook up RAL Classic codes as HEX, RGB and CMYK, search by name or find the nearest RAL.RGB to HSLConvert RGB values to HSL, HSV and HWB with a live swatch and copy-ready CSS.Color Code ConverterConvert a color between HEX, RGB, HSL, HSV, CMYK, LAB, LCH and OKLCH with a live swatch.Room Paint Color VisualizerUpload a room photo, select the walls and preview any paint color or HEX with real lighting.Photo to Pop ArtMake Warhol-style pop art from a photo: posterized color tiles in 1, 4 or 9 grids with custom palettes.Screen Color PickerPick any pixel color from anywhere on your screen and copy it as HEX, RGB or HSL.Solid Color Image GeneratorMake a plain single-color or transparent image in any size, like 1920x1080, as PNG or JPG.White Balance CorrectorFix color casts: click a neutral gray point or use auto gray world, then fine-tune temperature and tint.CMYK to HEXConvert CMYK percentages to a HEX color code and RGB, with a live swatch and shades.Photo Color MatchCopy the color grading of a reference photo onto your image (Reinhard color transfer).Underwater Photo Color CorrectionRestore lost reds and remove the blue or green cast from underwater photos by depth.
See all 38 Color Tools →