Notification
Go to Home All Tools Compare Glossary Blog Contact

Gray Color Code: HEX, RGB, HSL and CMYK

Gray is #808080 in hex, rgb(128, 128, 128) in RGB and hsl(0, 0%, 50%) in HSL. Copy any format, check contrast and see shades and matching colours.

Client-Side (Private)
HEX #808080
RGB rgb(128, 128, 128)
HSL hsl(0, 0%, 50%)
HSV hsv(0, 0%, 50%)
CMYK cmyk(0%, 0%, 0%, 50%)
Contrast on white 3.95:1
Live Preview
#808080 Gray
e.g. gray
Quick try:
Converted Result (ALL)

How to use gray in CSS

Step-by-step mathematical method you can verify by hand

  1. Use the colour name: color: gray; or background: gray;
  2. Or use the hex code: color: #808080;
  3. Or use RGB: color: rgb(128, 128, 128); and add transparency with rgba or rgb(... / 50%).
  4. Or use HSL to adjust it: hsl(0, 0%, 50%). Raise the last number to lighten, lower it to darken.

Gray in every format

Worked Hand Example
FormatValue
HEX#808080
RGBrgb(128, 128, 128)
HSLhsl(0, 0%, 50%)
HSVhsv(0, 0%, 50%)
CMYKcmyk(0%, 0%, 0%, 50%)
Decimal8421504
gray = #808080.

Shades and tints of gray

The hue and saturation of gray stay the same and only the HSL lightness changes, so every row is the same colour family.

ShadeHEXHSL lightness
Lightest #e6e6e6 90%
Lighter #bfbfbf 75%
Light #999999 60%
Gray #808080 50%
Dark #666666 40%
Darker #404040 25%
Darkest #1f1f1f 12%

Colours that go with gray

Colour-wheel harmonies calculated by rotating the hue.

HarmonyHEXRGB
Complementary #808080 rgb(128, 128, 128)
Analogous (+30°) #808080 rgb(128, 128, 128)
Analogous (−30°) #808080 rgb(128, 128, 128)
Triadic (+120°) #808080 rgb(128, 128, 128)
Triadic (+240°) #808080 rgb(128, 128, 128)
Split-complementary (+150°) #808080 rgb(128, 128, 128)
Split-complementary (+210°) #808080 rgb(128, 128, 128)

Contrast of gray with black and white text

WCAG 2.x contrast ratios.

Text colourRatioAA normal (4.5)AA large (3)
White 3.95:1 Fail Pass
Black 5.32:1 Pass Pass

More colour codes

Quickly jump to other conversions and color systems

Education

About this converter

01

Exact and Explained

Gray is #808080 in hex, rgb(128, 128, 128) in RGB and hsl(0, 0%, 50%) in HSL. Copy any format, check contrast and see shades and matching colours. The worked example and tables on this page are calculated from the numbers themselves, so you can check the result by hand.

02

Privacy

The conversion runs in your browser. Nothing you type is sent to a server.

Good to know

Questions, answered

Quick answers about how this tool works.

gray is #808080 in hex, rgb(128, 128, 128) in RGB and hsl(0, 0%, 50%) in HSL.

gray is rgb(128, 128, 128). In the simple CMYK formula it is cmyk(0%, 0%, 0%, 50%) (a screen conversion, not a print profile).

Yes. You can write color: gray; in CSS and it means exactly #808080.

Black text has a contrast ratio of 5.32:1 and white text 3.95:1 on this colour. Black is the better choice. WCAG AA needs 4.5:1 for normal text.

Was this tool helpful?

★ 5.0 • 2 user ratings

Tap a star to rate instantly

What do you need to work out next?

Search 278+ free tools by name, or pick a category below. Every one runs instantly in your browser — no signup, nothing to install.

More Developer Tools
AI ADVISOR & COACH

Ask AI Advisor

Ask AI