Gray #808080

Gray color (#808080)

Gray is one of the 148 CSS named colors. Use the keyword gray anywhere CSS accepts a color, or its hex code #808080, which is rgb(128, 128, 128) in RGB. The keyword grey produces exactly the same color.

It is a medium neutral and a perceived lightness of 60% in OKLCH. On a gray background, black text gives the higher contrast at 5.31:1, which passes WCAG AA for normal text.

Gray color codes

CSS name gray
HEX #808080
HEX (8-digit) #808080FF
RGB rgb(128, 128, 128)
HSL hsl(0, 0%, 50%)
HSV / HSB hsv(0, 0%, 50%)
OKLCH oklch(60% 0 89.9)
CMYK cmyk(0%, 0%, 0%, 49.8%)

Contrast with white and black

WCAG 2 contrast ratios and APCA lightness contrast (Lc) for gray used as text and as a background.

Aa Sample text
Gray text on white
3.94:1 WCAG Lc 66.9 APCA AA large text only
Aa Sample text
Gray text on black
5.31:1 WCAG Lc -34.8 APCA Passes AA
Aa Sample text
White text on gray
3.94:1 WCAG Lc -72.4 APCA AA large text only
Aa Sample text
Black text on gray
5.31:1 WCAG Lc 37.2 APCA Passes AA

Tints and shades of gray

Tints mix gray with white; shades mix it with black, in 10% steps. Click a swatch to copy it, or build custom scales in the tint & shade generator.

Tints

Shades

Colors that go with gray

Harmonies calculated on the HSL color wheel. Explore more in the color scheme generator.

Complementary

Analogous

Triadic

Split-Complementary

Gray with color blindness

Approximately how gray appears with each type of color vision deficiency. Test full designs with the color blindness simulator.

Using gray in CSS

.element {
  color: gray;
  background-color: #808080;
  border-color: rgb(128 128 128 / 50%);
  outline-color: oklch(60% 0 89.9);
}

Similar named colors

See all shades of gray or browse every CSS color name.

Related tools