CSS named color
Gray #808080
Gray is a medium gray with the hex code #808080, which converts to rgb(128, 128, 128). The British spelling grey is an alias and renders exactly the same color. Open #808080 in the converter to tweak it.
Gray color values
| HEX | #808080 |
|---|---|
| HEX (shorthand) | — |
| RGB | rgb(128, 128, 128) |
| RGBA | rgba(128, 128, 128, 1) |
| 8-digit HEX | #808080FF |
| HSL | hsl(0, 0%, 50%) |
| HSV / HSB | 0°, 0%, 50% |
| CMYK | 0%, 0%, 0%, 50% |
| RGB 0–1 | 0.502, 0.502, 0.502 |
| Decimal | 8421504 |
| CSS keyword | gray |
How #808080 converts to RGB
Split the hex code into three pairs and read each pair as a base-16 number: 80 → 128, 80 → 128, 80 → 128. That gives rgb(128, 128, 128). The step-by-step guide explains the math.
Shades of Gray
Mixed toward black in 10% steps. Click a swatch to copy its hex.
Tints of Gray
Mixed toward white in 10% steps.
Color harmonies
Hue rotations of Gray on the HSL color wheel, keeping saturation and lightness fixed. The color harmony guide explains when each scheme works.
Gray has no hue (saturation is 0%), so hue-based harmonies collapse to the same gray. Grays pair with any accent color — pick one from the palette generator.
Contrast and accessibility
| Text | Background | Ratio | WCAG 2.x |
|---|---|---|---|
| White | Gray | 3.94:1 | AA Large only |
| Black | Gray | 5.31:1 | AA |
Use black text on a gray background. Test any other pair in the contrast checker; thresholds are explained in the WCAG contrast guide.
Use Gray in CSS
.element {
color: gray; /* keyword */
background-color: #808080; /* hex */
border-color: rgb(128 128 128 / 50%); /* 50% transparent */
}
Need it semi-transparent? Append an alpha byte: #80808080 is Gray at 50% opacity. See RGBA & transparency.
Similar named colors
FAQ
What is the HEX code for Gray?
The CSS named color gray is #808080 in hexadecimal. In CSS you can write color: gray; or color: #808080; — both produce the same pixel.
What is Gray in RGB?
Gray is rgb(128, 128, 128): red 128, green 128, blue 128 on the 0–255 scale. As normalized 0–1 floats that is (0.502, 0.502, 0.502).
Is white or black text more readable on Gray?
Black text is more readable. White on #808080 has a contrast ratio of 3.94:1 (AA Large only), black on #808080 has 5.31:1 (AA). WCAG AA needs 4.5:1 for normal text.