Gray
Gray is a medium gray with no tint at all. Hex code #808080.
Color codes
- CSS name
gray, grey - HEX
#808080 - RGB
rgb(128 128 128) - HSL
hsl(0 0% 50%) - HSB / HSV
hsb(0, 0%, 50%) - OKLCH
oklch(60% 0 0) - CMYK
cmyk(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
Tones
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.
More tools
Work with this color
- Color picker and converterPick a color and get HEX, RGB, HSL, HSB, CMYK and OKLCH, plus shades and harmonies.
- Contrast checkerCheck text and background colors against WCAG AA and AAA, and fix failing ones.
- CSS color namesAll 148 named colors with hex codes, shades, contrast and matching palettes.
- Palette generatorBuild a color palette from harmony rules, with shades and CSS variables.
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.