# Gray Color Code: #808080 Hex, RGB & Palettes

The CSS gray reference is #808080, rgb(128, 128, 128), or hsl(0, 0%, 50.2%). Brand shades may differ. HEX and RGB encode the same sRGB reference; HSL is rounded to two decimals. These are screen values, not a CMYK print specification.

## Tints and shades

Illustrative mixes with white or black in encoded sRGB channels, not a perceptually uniform scale.

| Shade | HEX | RGB | HSL | Black text contrast | White text contrast |
| --- | --- | --- | --- | --- | --- |
| Tint 80% | #E6E6E6 | rgb(230, 230, 230) | hsl(0, 0%, 90.2%) | 16.83:1 | 1.25:1 |
| Tint 40% | #B3B3B3 | rgb(179, 179, 179) | hsl(0, 0%, 70.2%) | 10.02:1 | 2.10:1 |
| Reference | #808080 | rgb(128, 128, 128) | hsl(0, 0%, 50.2%) | 5.32:1 | 3.95:1 |
| Shade 25% | #606060 | rgb(96, 96, 96) | hsl(0, 0%, 37.65%) | 3.34:1 | 6.29:1 |
| Shade 50% | #404040 | rgb(64, 64, 64) | hsl(0, 0%, 25.1%) | 2.03:1 | 10.37:1 |

## Text contrast

AA ordinary text requires at least 4.5:1; large text requires at least 3:1. Large text is at least 18pt, or 14pt bold. Use unrounded ratios for decisions. Color pairs alone cannot certify accessibility; review criteria, states, context, and exceptions.

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.

## How to use gray in product design

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 a foreground, surface, accent, or status role and name a semantic token after its purpose.
2. Test the actual pair, text size, interaction states, and themes.
3. Document the approved value and companion colors. Keep labels and non-color cues for states.

## CSS palette

Illustrative numeric tokens; connect tested pairs to semantic roles.

```css
:root {
  --gray-100: #E6E6E6;
  --gray-300: #B3B3B3;
  --gray-500: #808080;
  --gray-700: #606060;
  --gray-900: #404040;
}
```

## What is the HEX code for gray?

The CSS named color gray is #808080. Use a documented brand token when you mean another shade.

## Is gray accessible?

A color alone cannot pass or fail accessibility. Evaluate the pair, content size, interaction state, and meaning in the complete interface.

## Related colors

- [black color codes](https://designproject.io/resources/colors/black/)

- [white color codes](https://designproject.io/resources/colors/white/)

- [navy color codes](https://designproject.io/resources/colors/navy/)

## Sources and next steps

By The Design Project. UI examples and generated scales are illustrative.

- [MDN CSS named colors](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/named-color)
- [W3C contrast guidance](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html)
- [UI color palette guide](https://designproject.io/resources/guides/create-ui-color-palette/)
- [Semantic color tokens](https://designproject.io/resources/guides/create-semantic-color-tokens/)
- [Color contrast checker](https://designproject.io/resources/guides/check-color-contrast/)
- [Design glossary](https://designproject.io/resources/glossary/)

Canonical: https://designproject.io/resources/colors/gray/

## Keep learning

- [How to create a UI color palette, step by step](https://designproject.io/resources/guides/create-ui-color-palette/)
- [Product design glossary: 44 terms explained](https://designproject.io/resources/glossary/)
- [How to create semantic color tokens for UI](https://designproject.io/resources/guides/create-semantic-color-tokens/)
