Gray Hex Code #808080
Gray is a medium gray with the hex code #808080. In RGB it is 128, 128, 128, and in HSL it is 0°, 0%, 50%. It is one of the 148 named colors in CSS, so you can write “gray” instead of the hex code. It is also written as “grey”.
- HEX
- #808080
- RGB
- rgb(128, 128, 128)
- HSL
- hsl(0, 0%, 50%)
- HSV
- hsv(0°, 0%, 50%)
- CMYK
- cmyk(0%, 0%, 0%, 50%)
- CSS name
- gray
CMYK is a simple screen-to-print estimate. Real print results depend on the printer and paper.
About Gray
On a white background Gray has a contrast ratio of 3.95:1 (AA Large), and on black 5.32:1 (AA). Black text is the better choice on top of it.
It has almost no hue of its own, so it pairs comfortably with almost any accent color.
Grays do much of the quiet work in interface design: text, borders, backgrounds and disabled states. Because they carry no strong hue, they pair with almost any accent color.
Good to know: In CSS, gray (#808080) is darker than darkgray (#a9a9a9). The names come from older standards, so do not rely on “dark” and “light” prefixes to predict the order. Gray and grey are identical in CSS.
Shades and tints of Gray
Tints mix Gray with white and shades mix it with black, in steps of 20%. Select a swatch to copy its hex code.
Pairing Gray with an accent color
Gray has almost no hue of its own, so color schemes built from it would all look the same. A neutral works best as a background or text color beside an accent. This is how six accent colors contrast with Gray.
Gray contrast and accessibility
WCAG asks for a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text (AA), and 7:1 and 4.5:1 for AAA. This is how Gray scores against white and black.
| Against | Ratio | AA normal | AA large | AAA normal | AAA large |
|---|---|---|---|---|---|
| White (#ffffff) | 3.95:1 | ✕ Fail | ✓ Pass | ✕ Fail | ✕ Fail |
| Black (#000000) | 5.32:1 | ✓ Pass | ✓ Pass | ✕ Fail | ✓ Pass |
Gray and color blindness
These are approximate previews of how Gray can look with the main types of color vision deficiency.
Gray looks almost the same.
Gray looks almost the same.
Gray looks almost the same.
Gray looks almost the same.
Gradients with Gray
Three ready-made starting points. Copy the CSS, or open one in the generator to edit the stops and check contrast.
Gray to a lighter tint
background: linear-gradient(135deg, #808080 0%, #cccccc 100%); Gray to a darker shade
background: linear-gradient(135deg, #808080 0%, #333333 100%); Colors similar to Gray
How each close match differs from Gray.
Use Gray in code
.element {
color: #808080;
background-color: #808080;
border-color: gray; /* gray is a valid CSS color name */
} :root {
--color-gray: #808080;
} <!-- Tailwind arbitrary values -->
<div class="bg-[#808080] text-[#808080] border-[#808080]"></div>
/* Tailwind v4 theme color */
@theme {
--color-gray: #808080;
} Gray questions
What is the hex code for Gray?
The hex code for Gray is #808080. In RGB that is rgb(128, 128, 128), and in HSL it is hsl(0, 0%, 50%).
Which colors go well with Gray?
Gray is a neutral color with almost no hue of its own, so it has no true complement and pairs with nearly any accent. The accents that contrast most strongly against it are Gold (2.82:1), Dark Orange (1.69:1), Dark Orchid (1.44:1).
Should I use white or black text on Gray?
Black text. It has a contrast ratio of 5.32:1 against Gray, which is WCAG AA. The other option scores 3.95:1.
Is Gray accessible as a text color on white?
Only for large text. Gray on white scores 3.95:1, which passes WCAG AA for large text (3:1) but not for normal text (4.5:1).
What are darker and lighter shades of Gray?
Mixing Gray with black gives #666666, #4D4D4D, #333333, #1A1A1A (20% to 80% black). Mixing it with white gives #999999, #B3B3B3, #CCCCCC, #E6E6E6 (20% to 80% white).