Browse all tools
Photo and videoCategory overviewPrint Size CalculatorDepth of Field CalculatorCrop Factor and Equivalent Focal Length CalculatorND Filter Exposure CalculatorFlicker-Free Shutter Speed CalculatorTimelapse CalculatorVideo File Size and Bitrate CalculatorAspect Ratio Calculator
Image filesCategory overviewImage Resizer and ConverterPNG to JPG ConverterJPG to PNG ConverterWebP to JPG ConverterJPG to WebP ConverterPNG to WebP ConverterHEIC to JPG ConverterEXIF Metadata Remover
Color and screensCategory overviewColor Converter and Contrast CheckerColor Palette Extractor and GeneratorColor Screen GeneratorDead Pixel TestScreen Refresh and Flicker TestBroken Screen Simulator
Everyday toolsCategory overviewUnit ConverterPercentage CalculatorOnline StopwatchExam Timer

More

All guidesAbout

Color Converter and Contrast Checker

Convert HEX to RGB and HSL and check text contrast against WCAG accessibility guidelines.

About this tool

Enter two colors to see their RGB and HSL values and whether they have enough contrast for readable text. WCAG AA asks for 4.5:1 for normal text and 3:1 for large text.

Read more in our color and contrast guide.

How to use it

  1. Enter two colors as HEX codes, for example #1A2B3C.
  2. Read their RGB and HSL values.
  3. Check the contrast ratio and the pass or fail result for normal and large text.

How the contrast ratio is calculated

Each color is converted to a relative luminance, a measure of its brightness that follows how the eye responds. The contrast ratio is (L1 + 0.05) ÷ (L2 + 0.05), where L1 is the lighter color. The ratio runs from 1:1, with no contrast, up to 21:1 for black on white.

Worked examples

  • Black on white is 21:1, the maximum.
  • Gray #767676 on white is 4.54:1, which is the lightest gray that still passes the 4.5:1 AA requirement for normal text.
  • Gray #777777 on white is 4.48:1, which narrowly fails.

WCAG requirements

LevelNormal textLarge textInterface components
AA4.5:13:13:1
AAA7:14.5:1Not specified

Large text means at least 24 px (18 pt) regular, or 18.66 px (14 pt) bold.

Common mistakes

  • Checking only the text and ignoring buttons, icons and form borders, which also need 3:1.
  • Using color alone to communicate meaning, such as red for an error, without an icon or label.
  • Testing text over a photograph or gradient at one point only. Check the worst-case area.
  • Forgetting dark mode, where the same colors give a different contrast.

Questions

What is a good contrast ratio?

At least 4.5:1 for body text and 3:1 for large text or interface elements. 7:1 meets the stricter AAA level.

Can I use 3-digit HEX codes?

Yes. #FA0 is read as #FFAA00.

What is the difference between AA and AAA?

AA is the usual target for most websites. AAA is stricter and is not always achievable for all content.

Does a passing ratio guarantee readability?

No. Font size, weight, spacing and the viewing situation matter too, but passing is a solid minimum.

More free tools