Contrast ratio

  • AA normal text 4.5:1
  • AA large text 3:1
  • AAA normal text 7:1
  • AAA large text 4.5:1
  • UI components and graphics 3:1

Readable for everyone

A large subheading

Body text is where low contrast hurts most, because people read it for longer at a small size. A text link

Button

Nearest passing colors

    Saved colors

      More about color contrast

      Color contrast checker

      Check whether text is readable on its background before you ship a design. Pick or type a text color and a background color, and the checker shows the WCAG 2.x contrast ratio with pass or fail results for AA and AAA, for normal and large text and for UI components. A live preview, color blindness simulation and suggested fixes help you find a pair that works. Pick a text color and a background as HEX, RGB or HSL. The WCAG contrast ratio, the AA and AAA results and the preview update as you type, and the nearest passing colors are suggested. Everything is saved in this browser.

      How it works

      1. Pick a text color and a background color, or type them as HEX, RGB or HSL. Set the text opacity if the text is semi transparent.
      2. Read the contrast ratio and the pass or fail badges for AA and AAA normal text, large text and UI components, and check the live preview.
      3. Apply a suggested color if the pair fails, save good pairs to your palette and copy the CSS into your project.

      Fixes, not only scores

      When a pair fails, the checker searches for the closest text color and the closest background color with the same hue and saturation that reaches AA and AAA, and one click applies it. Semi transparent text is blended over the background first, exactly as a browser draws it.

      Private and portable

      Your colors and saved palette are stored in this browser only. Save everything as JSON to back it up or move it to another device, or save the result as a PDF or image. Undo and redo cover every change.

      Frequently asked questions

      What does the color blindness simulation show?

      It redraws the preview as someone with protanopia, deuteranopia or tritanopia (no red, green or blue cones) or achromatopsia (no color vision) would see it, and shows the contrast of the simulated pair below. The pass and fail badges always use your real colors.

      Which ratio do I need?

      WCAG level AA asks for at least 4.5:1 for normal text and 3:1 for large text and for UI components such as input borders and icons. Level AAA asks for 7:1 for normal text and 4.5:1 for large text.

      Why does 4.48 fail when it rounds to 4.5?

      WCAG thresholds are exact. A ratio of 4.48:1 is below 4.5:1, so it fails AA for normal text. The checker compares the unrounded ratio, so the badges are always strict.

      How is the contrast ratio calculated?

      As (L1 + 0.05) / (L2 + 0.05), where L1 is the relative luminance of the lighter color and L2 of the darker one. Luminance weights the linearized red, green and blue channels by 0.2126, 0.7152 and 0.0722, so green counts most. The result runs from 1:1 for two equal colors to 21:1 for black on white.

      Ready to try it?

      Open PictorX in your browser — no install, no credit card required to start.

      前往編輯器