Inspect Gray (#808080) in HEX, RGB, HSL, LCH and OKLCH, check its contrast, and copy the value you need.
Gray
#808080
Black text reads best on this background, at 5.32:1.
Gray is one of the 148 CSS named colors, and resolves to #808080 in every browser. In numbers that is rgb(128, 128, 128) and hsl(0, 0%, 50%). Perceptually it is a mid-toned, near-neutral color: OKLCH puts its lightness at 60% and its chroma at 0. It carries almost no chroma, so it behaves as a neutral rather than as a hue, and belongs with the grays.
White text only reaches 3.95:1 here, so black text is the safer pairing at 5.32:1. With this little chroma it recedes, which makes it useful for borders, dividers and secondary surfaces.
The closest CSS named colors to Gray, measured with CIEDE2000, are SlateGray (#708090), SlateGrey (#708090), DimGray (#696969). If Gray is not quite right, those are the nearest keywords to try before reaching for a custom value.
HEX
#808080
RGB
rgb(128, 128, 128)
HSL
hsl(0, 0%, 50%)
HWB
hwb(0 50% 50%)
CMYK
cmyk(0%, 0%, 0%, 50%)
LAB
lab(53.59 0 0)
LCH
lch(53.59 0 0)
OKLCH
oklch(59.99% 0 0)
WCAG asks for 4.5:1 between body text and its background. On #808080 white text measures 3.95:1 and black text 5.32:1, so black clears it and white does not.
White text on Gray
WCAG 2.2
3.95:1
APCA
Lc 72
Fails AA body text
Fails AAA body text
Passes AA large text
Black text on Gray
WCAG 2.2
5.32:1
APCA
Lc 37
Passes AA body text
Fails AAA body text
Passes AA large text
Check Gray against any other color in the contrast checker.
Gray sits at 60% OKLCH lightness. Holding its hue and chroma and moving only that value carries it up to #F8F8F8 and down to #060606, which keeps the family recognizable instead of letting it drift toward gray the way a plain HSL ramp does.
#979797
20% lighter
#AEAEAE
40% lighter
#C6C6C6
60% lighter
#DFDFDF
80% lighter
#F8F8F8
100% lighter
#646464
20% darker
#4A4A4A
40% darker
#313131
60% darker
#1A1A1A
80% darker
#060606
100% darker
Build a full accessible scale from #808080 in the shade generator.
Gray barely moves under any of the four common forms of color blindness, the largest shift being 0 CIEDE2000 units under protanopia. It stays recognizable, though it still should not be the only thing carrying meaning.
Protanopia
#808080
Deuteranopia
#808080
Tritanopia
#808080
Achromatopsia
#808080
The nearest CSS keywords to #808080, ranked by perceptual distance rather than by how close their hex digits happen to look.
SlateGray
#708090
SlateGrey
#708090
DimGray
#696969
DimGrey
#696969
LightSlateGray
#778899
LightSlateGrey
#778899