#808080: CSS gray color codes, contrast and shades

By TechCompare · Updated · How we check

#808080 is rgb(128, 128, 128), the CSS named color gray, with all three channels at 128. As text on white it gets 3.95:1, which only passes for large text.

#808080

Color Codes

  • HEX#808080
  • RGBrgb(128, 128, 128)
  • HSLhsl(0, 0%, 50%)
  • OKLCHoklch(59.99% 0 0)

Text on #808080

White Text

Aa

The quick brown fox jumps over the lazy dog.

3.95:1APCA Lc -72.4

  • AA Normal (4.5:1)Fail
  • AA Large (3:1)Pass
  • AAA Normal (7:1)Fail
  • AAA Large (4.5:1)Fail
Check White Text in Contrast Checker

Black Text

Aa

The quick brown fox jumps over the lazy dog.

5.32:1APCA Lc 37.2

  • AA Normal (4.5:1)Pass
  • AA Large (3:1)Pass
  • AAA Normal (7:1)Fail
  • AAA Large (4.5:1)Pass
Check Black Text in Contrast Checker

WCAG 2 ratios are the same whichever color is the text, so they also hold for #808080 text on a white or black page. APCA is a newer method that isn't part of any WCAG standard, and a minus sign means light text on dark.

#808080 sets red, green and blue to the same value, 128, so it has no hue at all. It's the CSS color gray, which you can also spell grey. The cards above give its codes and test white and black text on it. Below are 4 lighter and 4 darker shades, all neutral.

Shades

Same hue and chroma in OKLCH, with even steps of lightness. Open any shade in the Color Picker.

  1. #F5F5F5
  2. #D6D6D6
  3. #B9B9B9
  4. #9C9C9C
  5. Base#808080
  6. #6A6A6A
  7. #555555
  8. #414141
  9. #2E2E2E

Nearest Named Colors

  • CSS Name

    gray or grey

    #808080

    ExactΔE OK 0.000
  • Tailwind 4

    olive-500

    oklch(58% 0.031 107.3)

    CloseΔE OK 0.037
  • Tailwind 3

    neutral-500

    #737373

    CloseΔE OK 0.044

About #808080

CSS gray names don't line up the way they read. The name gray comes from the old VGA palette, while darkgray, #A9A9A9, comes from the X11 list. So darkgray is the lighter of the two, at an OKLCH lightness of 73.48% against 59.99%. The CSS spec itself points this out.

Halfway in code isn't halfway in light. The channel value sits at about the middle of its range, but screens don't turn values into light in a straight line, so #808080 gives off less than a quarter of the light of white. That's also why white text on it only reaches 3.95:1.

For text on it, WCAG 2 picks black at 5.32:1 over white at 3.95:1. APCA, a newer method that isn't part of any WCAG standard, leans the other way, at Lc -72.4 for white and Lc 37.2 for black. If you want gray body text on white that passes AA, #767676 is the lightest neutral gray that does, at 4.54:1. #777777 already falls short at 4.48:1.

Verdict

Use #808080 for borders, dividers, icons and input outlines on white. At 3.95:1 it clears the 3:1 that WCAG 2.1 asks for parts of a control people need to see. Keep it off normal size text on white, where it fails AA.

One step down the scale, #6A6A6A, gets white text and text on white to 5.41:1 and passes AA. The lighter steps fall under 3:1 against white, so use them for backgrounds and disabled states, not for borders that have to show. Click a shade to open it in the Color Picker.

More Color scenarios

Hex to RGB
A hex color code is three RGB numbers written in base 16.
View details
RGB vs CMYK
Screens add light and print adds ink. See one color in both, and why a plain CMYK formula can't promise a print match.
View details
HSL color model
Hue, saturation and lightness, with three live sliders and a table of common colors in hex, RGB and HSL.
View details

Frequently asked questions

What color is #808080?
A neutral middle gray: rgb(128, 128, 128), hsl(0, 0%, 50%) or oklch(59.99% 0 0). CSS calls it gray or grey.
Is #808080 lighter or darker than darkgray?
Darker. CSS darkgray is #A9A9A9, with an OKLCH lightness of 73.48% against 59.99% for #808080. The two names come from different color lists, which is why they don't match what they say.
Does #808080 text pass WCAG on white?
Only for large text. It scores 3.95:1, under the 4.5:1 AA asks for normal text but over the 3:1 for large text. For normal text, #767676 is the lightest neutral gray that passes, at 4.54:1.