Skip to content
Let’s chat ↗

THE COLOR LIBRARY / Neutral

Gray color codes.

The CSS gray color code is #808080. Its RGB value is rgb(128, 128, 128) and its HSL value is hsl(0, 0%, 50.2%). Start with the exact reference, then choose a shade for the job.

A color name describes a family in everyday language. This page uses the standardized CSS keyword as its reference; your brand’s gray may be different.

Explore the shades ↓
CSS / grayGray#808080

COPY. PASTE. MAKE IT YOURS.

Gray in HEX, RGB, and HSL

HEX#808080
RGBrgb(128, 128, 128)
HSLhsl(0, 0%, 50.2%)

HEX and RGB encode the same sRGB reference. HSL is calculated from it and rounded to two decimals for display. These are screen color values, not a CMYK print specification.

ONE COLOR. DIFFERENT ROLES.

Explore gray tints and shades

Select a swatch to see its codes and compare text contrast.

UI COLOR SPECIMEN

Make the next step clear.

A label, a surface, and room to breathe.

Selected: Reference

Selected color

Reference · #808080

rgb(128, 128, 128)hsl(0, 0%, 50.2%)

The specimen picks whichever of black or white has higher contrast. It demonstrates a pair, not a complete accessible component.

Illustrative scale: tints mix the reference with white, shades with black, by the stated percentage in encoded sRGB channels. This is not a perceptually uniform scale. Black tints and white shades remain useful; mixing black with black or white with white repeats the reference.

Text contrast on gray

The table follows your selected swatch, currently #808080. Decisions use the full calculated ratio; displayed ratios are rounded.

Text against the selected gray surface
Text colorRatioAA ordinary textAA large text
Black #0000005.32:1Pass · 4.5:1Pass · 3:1
White #FFFFFF3.95:1Fail · 4.5:1Pass · 3:1

Large text is at least 18pt, or 14pt bold. These numeric checks apply to opaque, solid color pairs. Other criteria, states, backgrounds, and exceptions need review. Read W3C’s contrast guidance.

CSS gray and grey share #808080. This middle gray fails ordinary-text AA on white, so a secondary text role typically needs a darker value.

Check a custom color pair ↗

IN A REAL INTERFACE

How to use gray in product design

Give it one clear role

Gray provides a foundation for secondary text, dividers, and neutral surfaces, but each role needs its own value. One middle gray cannot serve all of these jobs against every background.

A UI example to try

A table can use dark primary values, a separately tested gray for metadata, and a lighter divider. Do not reduce the opacity of the whole row to create hierarchy because it also changes controls.

Work through a real screen

Audit gray roles in a form: primary text, secondary text, disabled controls, borders, and surfaces. These roles often accumulate similar values over time. Record their purpose before merging them, because a divider and an essential control boundary can have different requirements even when they currently look alike.

Compare nearby colors by purpose

Compare neighboring gray values in the full interface, not only side by side in a palette. A subtle difference that seems obvious in a large swatch may disappear in a thin border or small label. Keep role names more descriptive than a brightness number alone.

  1. Choose the role. Decide whether gray is a surface, foreground, accent, or status. Name the semantic token after that purpose.
  2. Test the actual pair. Compare its foreground and background at the intended size. Test hover, selected, focus, and supported themes independently.
  3. Document the decision. Keep the approved code, usage rule, and contrasting companion together. Preserve labels and non-color cues when communicating a state.

Copy a gray CSS palette

These numeric names are illustrative palette tokens, not a standard scale. Connect approved values to semantic tokens such as --surface-highlight or --text-primary after testing their pairs.

:root {
  --gray-100: #E6E6E6;
  --gray-300: #B3B3B3;
  --gray-500: #808080;
  --gray-700: #606060;
  --gray-900: #404040;
}
Download CSS palette ↓

Turn palette values into semantic tokens ↗

Common questions about gray

What is the HEX code for gray?

The CSS named color gray is #808080. Use that exact value when you want the standardized reference; use your own documented token when you mean a particular brand shade.

Is gray accessible?

A color by itself cannot pass or fail accessibility. The foreground/background pair, content size, interaction state, and meaning all matter. Use the table above for the selected solid-color pair, then review the complete interface.

Explore related colors