100% free no uploads no sign-up

gray color code

The hex code for gray is #808080, which is rgb(128, 128, 128) in RGB and cmyk(0%, 0%, 0%, 50%) in CMYK. It's a medium, neutral gray. It is a built-in CSS colour, so you can also write it as “gray”.

#808080gray
White text: 3.94:1 large text onlyBlack text: 5.31:1 ✓ AANearest name: gray

Move the sliders to find a lighter, darker or softer gray; the codes update as you go.

Gray colour codes

HEX#808080
RGBrgb(128, 128, 128)
HSLhsl(0, 0%, 50%)
HSV / HSBhsv(0, 0%, 50%)
CMYKcmyk(0%, 0%, 0%, 50%)
Decimal8421504
CSS keywordgray, grey

About gray

Gray sits at a hue of 0° on the colour wheel, with 0% saturation and 50% lightness. With so little saturation it reads as a neutral, which makes it easy to pair with almost any accent colour.

For text, black reads better on gray. Gray as text on a white background has a contrast ratio of 3.94:1, which fails the WCAG AA rule for body text (4.5:1) and passes the 3:1 rule for large text. On black it is 5.31:1, which passes AA for body text.

Tints and shades of gray

Tints mix gray with white and shades mix it with black, in 10% steps. They're the easiest way to get lighter backgrounds and darker hover or text colours that still match.

#F2F2F2#E6E6E6#D9D9D9#CCCCCC#C0C0C0#B3B3B3#A6A6A6#999999#8D8D8D
gray #808080
#737373#666666#5A5A5A#4D4D4D#404040#333333#262626#1A1A1A#0D0D0D

Colours that go with gray

Complementary — opposite on the colour wheel: maximum contrast

#808080#808080

Analogous — neighbours 30° either side: calm and natural

#808080#808080#808080

Triadic — three hues 120° apart: lively but balanced

#808080#808080#808080

Split complementary — the two neighbours of the complement: contrast with less tension

#808080#808080#808080

Tetradic — four hues 90° apart: rich, use one as the main colour

#808080#808080#808080#808080

Gray text contrast

CombinationRatioAA normal (4.5:1)AA large (3:1)AAA (7:1)
gray on white3.94:1failpassfail
gray on black5.31:1passpassfail

Check gray against any other colour in the contrast checker.

How gray looks with colour blindness

Simulated with the Machado et al. (2009) model for the complete loss of one type of cone cell. Colour vision deficiency affects roughly 1 in 12 men and 1 in 200 women, most often as red-green colour blindness.

normal #808080protanopia #808080deuteranopia #808080tritanopia #808080

Use gray in code

.gray {
  color: gray;
  background-color: #808080;
  border-color: rgb(128, 128, 128);
}

Frequently asked questions

What is the hex code for gray?

Gray is #808080 (lowercase #808080). It's the official value of the CSS keyword “gray”, which can also be written “grey”.

What is gray in RGB, HSL and CMYK?

RGB: rgb(128, 128, 128). HSL: hsl(0, 0%, 50%). CMYK: cmyk(0%, 0%, 0%, 50%). CMYK is a simple conversion for reference; for professional printing, ask your printer for a matching ink or Pantone swatch.

What colours go with gray?

Gray is a neutral, so it goes with almost anything. For a classic look pair it with navy blue (#000080) or burgundy (#800020); for something brighter use coral (#FF7F50), teal (#008080) or mustard yellow (#FFDB58). Lighter and darker grays work as backgrounds and text alongside gray.

Is gray a warm or cool colour?

Gray is a neutral: its saturation is only 0%, so it doesn't lean clearly warm or cool.

Should I use black or white text on gray?

Black. Black text on gray has a contrast ratio of 5.31:1 and white text has 3.94:1. WCAG asks for at least 4.5:1 for normal text and 3:1 for large text.

How do I use gray in CSS?

Write color: gray; or color: #808080; — both give the same colour. Named colours work in every browser.

Colours similar to gray