Contrast ratio

white on CSS gray

#ffffff text on a #808080 background has a contrast ratio of 3.94:1. It passes WCAG 2.2 AA only for large text and UI parts. Normal text needs 4.5:1.

3.94:1

Fail
  • AA normal4.5:1
  • AA large3:1
  • AAA normal7:1
  • AAA large4.5:1
  • UI3:1
Open in the Contrast Checker

What this pair passes

Every WCAG 2.2 level for this pair, with the ratio each one needs.

  • Normal textWCAG AA
    Fail4.5:1 needed; 3.94:1.
  • Large textWCAG AA
    Pass3:1 needed; 3.94:1.
  • Normal textWCAG AAA
    Fail7:1 needed; 3.94:1.
  • Large textWCAG AAA
    Fail4.5:1 needed; 3.94:1.
  • Buttons, icons, and bordersWCAG 1.4.11
    Pass3:1 needed; 3.94:1.

APCA lightness contrast: Lc -72.4. For information only; WCAG 2.2 decides pass or fail. Ratios are cut, never rounded up.

As a button or badge

White label text on gray (#808080), checked for a real button.

  • Label size: White on gray is 3.94:1, so it works only for large or bold labels (24 px, or 18.66 px bold).
  • Hover and pressed: in the light theme ColorLint builds around #808080, hover is #676767 (5.65:1 with the label) and pressed is #595959 (7.00:1); both keep the label at AA.
  • ColorLint's button color: ColorLint's theme would use #757575 for this button, 4.60:1 with the label, the nearest version of #808080 that keeps the label readable.
  • Focus ring: #757575, 4.60:1 against a white page (3:1 needed).
  • APCA, for information: white on gray is Lc 72, enough for content text that is not body text.

Closest colors that pass AA for normal text

The nearest colors that pass, keeping one side exactly as it is.

Both ways round

The same two colors with text and background swapped.

white text on gray

3.94:1 · APCA Lc -72.4

gray text on white

3.94:1 · APCA Lc 66.9

The WCAG ratio is the same both ways. APCA, shown for information, changes with which color is the text.

About these colors

Each color in HEX, RGB, HSL, and OKLCH.

white

CSS named color · white

HEX: #ffffff

RGB: rgb(255 255 255)

HSL: hsl(0 0% 100%)

OKLCH: oklch(1 0 0)

CSS gray

CSS named color · gray

HEX: #808080

RGB: rgb(128 128 128)

HSL: hsl(0 0% 50.2%)

OKLCH: oklch(0.6 0 0)

Same color as grey.

Related pairs

Other prepared pages with these colors.

ColorLint checks color contrast only. Passing pairs do not mean a page is accessible. 1 pair checked; 0 could not be judged.

How we check colors