Skip to content

Gray

Gray is a medium gray with no tint at all. Hex code #808080.

Gray#808080

Color codes

  • CSS namegray, grey
  • HEX#808080
  • RGBrgb(128 128 128)
  • HSLhsl(0 0% 50%)
  • HSB / HSVhsb(0, 0%, 50%)
  • OKLCHoklch(60% 0 0)
  • CMYKcmyk(0%, 0%, 0%, 50%)

White text

3.94:1 · passes WCAG AA for large text only

Black text

5.31:1 · passes WCAG AA

Shades

50#F2F2F2
100#D4D4D4
200#B8B8B8
300#9C9C9C
400#828282
500#686868
600#4F4F4F
700#383838
800#222222

Tones

#2E2E2E
#4D4D4D
#808080
#929292
#B7B7B7

About this color

Gray in CSS and design

Gray is a medium gray with no tint at all. Gray is one of the 16 basic color keywords, which go back to HTML 4, long before CSS had 148 named colors.

CSS accepts both spellings, gray and grey, for every gray color name.

Use it in CSS by name or by any of its codes; these all give the same color:

color: gray;
color: #808080;
color: rgb(128 128 128);
color: hsl(0 0% 50%);

For text on gray, black reads best. Check other combinations with the contrast checker, or browse all CSS color names.

Frequently asked questions

What is the hex code for gray?

#808080. In CSS you can also use the keyword gray or grey, which works in every browser.

What is gray in RGB and HSL?

In RGB it is rgb(128 128 128), in HSL hsl(0 0% 50%). For print, cmyk(0%, 0%, 0%, 50%) is a starting point, but CMYK depends on paper and ink, so check with your printer.

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.

Which colors go with gray?

As a neutral, gray goes with almost any color. It works well as a background, border or text color next to a vivid accent, and with the lighter and darker tones from its shades.