Gray (Grey)
Gray is a true neutral, with equal parts red, green and blue. Hex code #808080.
Gray color codes
- CSS name
gray, grey - HEX
#808080 - RGB
rgb(128, 128, 128) - HSL
hsl(0, 0%, 50%) - OKLCH
oklch(60% 0 0)
HSB and CMYK values
- HSB / HSV
hsb(0, 0%, 50%) - CMYK
C0 M0 Y0 K50
White text
3.94:1 · passes WCAG AA for large text only
Black text
5.31:1 · passes WCAG AA
Shades of gray
A darker shade of gray is #4F4F4F (600), and a lighter one is #B8B8B8 (200).
Colors that go with gray
Tones
Gray has no complementary color: grays, black and white have no hue to turn around the color wheel.
Click a color to copy its hex code.
Colors similar to gray
- Dim gray#696969
Darker
- Dark gray#A9A9A9
Lighter
- Silver#C0C0C0
Lighter
- Light gray#D3D3D3
Much lighter
- Gainsboro#DCDCDC
Much lighter
- Linen#FAF0E6
Much lighter, a faint orange tint
Each compared with gray.
About this color
Gray in CSS and design
Gray is one of the 16 basic color keywords, which come from the VGA palette by way of HTML. These four lines all give the same gray:
color: gray;
color: #808080;
color: rgb(128, 128, 128);
color: hsl(0, 0%, 50%);What to know about gray
CSS gray is #808080, each channel at 128, half of 255. It is darker than dark gray (#A9A9A9) because the two come from different lists: dark gray comes from the X11 color list, whose own gray is the much lighter #BEBEBE. The CSS Color specification keeps these names not because they are good but because they have been in use for decades. Every gray name also works with the grey spelling.
Gray and the other grays
Gray sits between slate gray (#708090) and light slate gray (#778899) in lightness. As text on gray, black reaches the 4.5:1 contrast that WCAG AA asks for.
| Gray | Hex | Lightness | Contrast with gray |
|---|---|---|---|
| Black | #000000 | 0% | 5.31:1 |
| Dark slate gray | #2F4F4F | 40% | 2.26:1 |
| Dim gray | #696969 | 52% | 1.39:1 |
| Slate gray | #708090 | 59% | 1.02:1 |
| Gray | #808080 | 60% | – |
| Light slate gray | #778899 | 62% | 1.08:1 |
| Dark gray | #A9A9A9 | 73% | 1.68:1 |
| Silver | #C0C0C0 | 81% | 2.17:1 |
| Light gray | #D3D3D3 | 87% | 2.63:1 |
| Gainsboro | #DCDCDC | 89% | 2.88:1 |
| White smoke | #F5F5F5 | 97% | 3.62:1 |
| White | #FFFFFF | 100% | 3.94:1 |
Lightness is OKLCH lightness, which follows how light a color looks.
Frequently asked questions
What is the hex code for gray (grey)?
#808080. Gray and grey are two spellings for the same color, and CSS accepts both keywords, gray and grey, in every browser.
What is gray in RGB and HSL?
In RGB it is rgb(128, 128, 128) and in HSL hsl(0, 0%, 50%). In CMYK it is about C0 M0 Y0 K50, though printed colors vary with paper and ink.
Should I use black or white text on gray?
Black text works better: it has a contrast ratio of 5.31:1 and passes WCAG AA. White text reaches 3.94:1.
What is the complementary color of gray?
Gray has no complementary color. A complement is found by turning a color's hue halfway around the color wheel, and grays, black and white have no hue to turn.
Which colors go with gray?
As a neutral, gray goes with almost any color. Its own tones, from #2E2E2E to #B7B7B7, make a calm palette, and a single vivid accent stands out against it.