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.
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.