Color Conversion Tools

HEX to Color Name

Find the CSS color keyword that matches a HEX code, or the nearest one when there is no exact match. Useful for naming tokens, writing readable CSS examples, and describing a color in words.

HEX to Color Name

Edit a channel and see the color result immediately.

Swap direction

Enter HEX

Enter #RGB or #RRGGBB. These pair converters use opaque colors.

CSS color name result

Source color
Result color
steelblue

Closest of 148 CSS named colors; the name is an approximation.

The conversion runs in your browser.

All formats

HEX
#336699
RGB
rgb(51, 102, 153)
HSL
hsl(210, 50%, 40%)
HSV
hsv(210°, 66.7%, 60%)
CMYK
cmyk(66.7%, 33.3%, 0%, 40%)
OKLCH
oklch(49.9% 0.099 250.4)
CSS
≈ steelblue

Tints and shades

Text contrast (WCAG)

Aa6.00:1On whiteAA
Aa3.50:1On blackLarge text only

Normal text needs 4.5:1 for AA and 7:1 for AAA; large text needs 3:1.

How it was calculated

  1. R = 33₁₆ = 3 × 16 + 3 = 51
  2. G = 66₁₆ = 6 × 16 + 6 = 102
  3. B = 99₁₆ = 9 × 16 + 9 = 153
  4. ΔE(Oklab) → steelblue = #4682b4

Common colors in HEX and CSS color name

Choose a color to load it into the converter.

ColorHEXCSS color name
#000000black
#ffffffwhite
#ff0000red
#00ff00lime
#0000ffblue
#ffff00yellow
#00ffffaqua
#ff00fffuchsia
#808080gray
#800000maroon
#008000green
#000080navy
#ffa500orange
#4682b4steelblue
#663399rebeccapurple
#ff6347tomato

How to use

  1. Enter a HEX code such as #ff7f50, or pick one with the color picker.
  2. Read the CSS name and compare the two swatches; the note under the result says whether the match is exact or only the closest.
  3. Copy the keyword, or keep the HEX code when the nearest name is visibly different.

Examples

An exact keyword

#ff7f50 is exactly the value CSS defines for coral, so the keyword can replace the code without changing the color.

Input
#ff7f50
Output
coral

A near miss

lightcoral is #f08080. The blue channel differs by one, so the name is the closest match rather than an exact one.

Input
#f08081
Output
lightcoral

Why look up a name for a HEX code

A six-digit code is precise but hard to talk about. A name like coral or steelblue is easy to remember, search for and say out loud. People use this conversion to:

  • Name design tokens and variables. Knowing that a gray is closest to slategray helps choose a sensible variable name.
  • Write readable demos and docs. Tutorials often use keywords so readers can see the intent at a glance.
  • Describe colors in reviews or alt text. “A coral button” is clearer than “#ff7f50”.
  • Check a color quickly. If the nearest name surprises you, the code may have a typo.

How the match works

The browser’s 148 named colors are a fixed palette. When your code is exactly one of them, the result is marked as an exact match, and you can swap the code for the keyword without any visual change.

Most colors fall between keywords. In that case the converter converts your color and every keyword to Oklab, measures the distance, and returns the smallest. The result swatch then shows the keyword’s own color, so you can judge the difference before you copy anything. For #f08081 the answer is lightcoral, which is one step away in the blue channel.

When not to use the name

If the swatches look different, keep the HEX code. Names are a vocabulary, not a full color space: there are only a handful of greens and no keyword for most mid-tones. For precise work, the All formats panel also gives you HSL and OKLCH values that keep the exact color.

The reverse lookup is on Color Name to HEX. For channel numbers, see RGB to Color Name.

Frequently asked questions

How many CSS color names are there?

CSS Color Module Level 4 defines 148 keywords, from aliceblue to yellowgreen, plus transparent and currentcolor. A few are aliases with the same value, such as aqua and cyan or gray and grey.

How is the closest name chosen?

The converter compares colors in Oklab, a perceptual color space, and picks the keyword with the smallest distance. That follows how different two colors look rather than raw channel differences.

Should I replace HEX codes with names in my CSS?

Only for exact matches, and mostly in examples or prototypes. Design-system tokens are clearer as named variables such as --color-accent that hold a HEX value.

Is this a Pantone or brand color name?

No. These are the public CSS keywords that browsers understand. Pantone and other systems use proprietary references and need their own licensed tools.

Does the lookup happen online?

No. The list of names and the comparison run in your browser.

Related tools