Gray hex code

The hex code for gray is #808080, or rgb(128, 128, 128). CSS also accepts the keyword gray.

#808080
HEX#808080
RGBrgb(128, 128, 128)
HSLhsl(0, 0%, 50%)
HSV / HSBhsv(0, 0%, 50%)
OKLCHoklch(59.99% 0 0)
CMYKcmyk(0%, 0%, 0%, 50%)
HEX, 50% opacity#80808080
RGB, 50% opacityrgb(128 128 128 / 50%)
CSS namegray
Defined inHTML 4.01 (one of the original 16 color names)

About gray

CSS gray (#808080) is a middle gray, with each channel at about half strength. CSS accepts both spellings, gray and grey, for every gray name.

One naming quirk: darkgray (#A9A9A9) is lighter than gray, because the two names come from different color lists. Other grays include dimgray (#696969), silver (#C0C0C0) and lightgray (#D3D3D3).

Shades and tints of gray

Gray lands on the 600 step. The steps follow a lightness curve modeled on Tailwind CSS's default palette; build your own in the Tailwind color generator. For gray mixed with white, black or gray in even steps, use the tint and shade generator.

50#F7F7F7100#EFEFEF200#DEDEDE300#C8C8C8400#ACACAC500#9A9A9A600#808080700#676767800#555555900#464646950#292929

Colors that go with gray

Gray is a neutral color, so hue-based harmonies do not apply: it goes with any hue. Pair it with one accent color, or build a palette in the palette generator.

Text on gray

White text on gray: 3.95:1
Black text on gray: 5.32:1
TextRatioAA normalAA largeAAA normal
White3.95:1FailPassFail
Black5.32:1PassPassFail

The ratio is the same either way round, so gray text on a white background is also 3.95:1. Check other pairs in the color contrast checker.

Similar named colors

The CSS named colors closest to gray, by deltaE OK distance.

slategray #708090lightslategray #778899dimgray #696969cadetblue #5F9EA0steelblue #4682B4darkcyan #008B8B

See all 148 on the color names page.

Closest Tailwind CSS colors

olive-500 v4: olive-500, #7C7C67, deltaE OK 0.037

neutral-500 v3: neutral-500, #737373, deltaE OK 0.044

In Tailwind CSS v4 it is olive-500 (#7C7C67), and in v3 neutral-500 (#737373). For the exact color, use an arbitrary value such as bg-[#808080]. A deltaE OK of around 0.02 is roughly the smallest difference most people notice side by side. Browse every shade on the Tailwind CSS colors page.

Gray with color vision deficiency

Gray has almost no hue, so it looks the same with any type of color vision deficiency. What matters is its lightness contrast with the colors next to it.

Test a whole palette or image in the color blindness simulator.

Using gray in code

.example {
  color: gray;                 /* named color */
  background-color: #808080;  /* hex */
  border-color: rgb(128, 128, 128);
}

Frequently asked questions

What is the hex code for gray?
#808080. CSS also accepts the keyword gray, which means the same color.
What is gray in RGB?
rgb(128, 128, 128). In HSL it is hsl(0, 0%, 50%), and in OKLCH oklch(59.99% 0 0).
What text color goes on gray?
Black text has the higher contrast on #808080: 5.32:1, which meets AA for all text. White text reaches 3.95:1.
What is the closest Tailwind color to gray?
In Tailwind CSS v4 it is olive-500 (#7C7C67), and in v3 neutral-500 (#737373). For the exact color, use an arbitrary value such as bg-[#808080].
How do I make gray transparent?
Add an alpha value. Half-transparent gray is #80808080 as 8-digit HEX (80 is 128 out of 255) or rgb(128 128 128 / 50%).