Skip to content

CSS named color

Grey #808080

Grey (CSS keyword grey) has the hex code #808080 and the RGB value rgb(128, 128, 128): a medium neutral gray.

Grey#808080

British spelling of gray, with the same value (#808080). Both spellings are valid for all seven gray keywords in CSS Color Level 4.

The keyword gray has exactly the same value (#808080); browsers treat them as the same color.

Color codes for Grey

Color codes for Grey
CSS keywordgrey
HEX#808080
RGBrgb(128, 128, 128)
HSLhsl(0, 0%, 50%)
HWBhwb(0 50% 50%)
OKLCHoklch(60% 0 0)
CMYK (naive, no ICC profile)cmyk(0%, 0%, 0%, 50%)
Decimal8,421,504
Hue familyGrays and black
Same value asgray

Contrast and accessibility

On grey, black text has a contrast ratio of 5.31:1 and passes AA for normal text; white text reaches 3.94:1.

WCAG 2.2 contrast ratios (success criteria 1.4.3 and 1.4.6: AA needs 4.5:1 for normal text and 3:1 for large text, AAA needs 7:1 and 4.5:1). APCA Lc is the lightness contrast from the APCA-W3 0.0.98G model proposed for WCAG 3; a higher absolute value is more readable, and Lc 75 is its suggested minimum for body text.

Contrast and accessibility
PairRatioAAAA largeAAAAAA largeAPCA Lc
Black text on grey5.31:1PassPassFailPass37.2
White text on grey3.94:1FailPassFailFail−72.4
Grey text on white3.94:1FailPassFailFail66.9
Grey text on black5.31:1PassPassFailPass−34.8

Tints and shades

Each step mixes grey with white (tints) or black (shades) in gamma-encoded sRGB, the same result as color-mix(in srgb, grey, white 25%) in CSS.

Tints (mixed with white)

  1. 5%
    #868686
  2. 15%
    #939393
  3. 25%
    #a0a0a0
  4. 35%
    #acacac
  5. 45%
    #b9b9b9
  6. 55%
    #c6c6c6
  7. 65%
    #d3d3d3
  8. 75%
    #dfdfdf
  9. 85%
    #ececec
  10. 95%
    #f9f9f9

Shades (mixed with black)

  1. 5%
    #7a7a7a
  2. 15%
    #6d6d6d
  3. 25%
    #606060
  4. 35%
    #535353
  5. 45%
    #464646
  6. 55%
    #3a3a3a
  7. 65%
    #2d2d2d
  8. 75%
    #202020
  9. 85%
    #131313
  10. 95%
    #060606

Color harmonies

Rotating the hue in OKLCH while keeping lightness and chroma, grey's complementary color is #808080 (close to gray), its analogous colors are #808080 and #808080, and its triadic partners are #808080 and #808080. For text on top, black gives the higher contrast.

Color harmonies
HarmonyRotationColor
Complementary+180°#808080
Analogous−30°, +30°#808080#808080
Triadic+120°, +240°#808080#808080
Split-complementary+150°, +210°#808080#808080

Computed in OKLCH: the hue is rotated by 180° (complementary), ±30° (analogous), ±120° (triadic) and 180° ±30° (split-complementary) while lightness and chroma stay fixed. Results that fall outside sRGB are brought back with the CSS Color 4 gamut mapping algorithm. Because this uses OKLCH, the values differ from tools that rotate hue in HSL, but every color keeps the same perceived lightness.

Warm or cool?

Grey is close to neutral: its OKLCH chroma is only 0.000, so its temperature comes from context. It has no perceptible hue.

Nearest named and Tailwind colors

Distance is ΔE OK, the Euclidean distance in OKLab multiplied by 100. Values under about 2 are hard to tell apart side by side.

Nearest CSS named colors

Nearest CSS named colors
ColorHEXΔE OK
slategray#7080903.2
lightslategray#7788993.8
dimgray#6969697.9

Nearest Tailwind v4 colors

Nearest Tailwind v4 colors
ColorHEXΔE OK
olive-500#7c7c673.7
neutral-500#7373734.4
mist-500#67787c4.5

Code snippets

CSS
.element {
  color: grey;
  background-color: #808080;
  border-color: rgb(128 128 128);
  outline-color: oklch(60% 0 0);
}
Tailwind CSS
<div class="bg-[#808080] text-black">...</div>

/* or register it once in your CSS (Tailwind v4) */
@theme {
  --color-grey: #808080;
}
/* then use bg-grey, text-grey, border-grey */
SwiftUI
import SwiftUI

extension Color {
  static let grey = Color(red: 0.502, green: 0.502, blue: 0.502)
}
Jetpack Compose
import androidx.compose.ui.graphics.Color

val Grey = Color(0xFF808080)
Flutter
import 'package:flutter/material.dart';

const grey = Color(0xFF808080);
Android XML
<!-- res/values/colors.xml -->
<color name="grey">#808080</color>

Frequently asked questions

What is the hex code for grey?
The hex code for grey is #808080. The same color is rgb(128, 128, 128), hsl(0, 0%, 50%) and oklch(60% 0 0), and in CSS you can also write the keyword grey directly.
Is grey a warm or cool color?
Grey is close to neutral: its OKLCH chroma is only 0.000, so its temperature comes from context. It has no perceptible hue.
What colors go with grey?
Rotating the hue in OKLCH while keeping lightness and chroma, grey's complementary color is #808080 (close to gray), its analogous colors are #808080 and #808080, and its triadic partners are #808080 and #808080. For text on top, black gives the higher contrast.
Can you use white text on grey?
White text on grey has a contrast ratio of 3.94:1, which passes AA only for large text (24 px, or 18.66 px bold, and up) under WCAG 2.2. Black text reaches 5.31:1 and passes AA for normal text but not AAA. In APCA terms that is Lc −72.4 for white and Lc 37.2 for black.
Is grey the same as gray?
Yes. Both keywords are #808080 (rgb(128, 128, 128)). CSS Color 4 keeps both for compatibility, so use whichever your codebase already uses.

Last reviewed by Arielton Oberek.