Colour Formats

Hex to RGB

#e07a5f
Hex

Nearest named colour: salmon

Every format
Contrast
On white 2.95 Fails AA
On black 7.12 Passes AA
Local · three bytes in base 16, or a name
fbedeaf3cabfeaa694e28369da5f3fc0462596361d6b271540170c

A hex colour is three bytes written in base 16, one per channel: #e07a5f is red 224, green 122, blue 95. This shows the RGB, HSL and OKLCH equivalents together, accepts any of the 148 CSS colour names typed in place of a code, names the nearest one back for any colour you set, and reports how the colour performs against white and black text.

How to use the hex to rgb

1 Type or paste a hex code, or a CSS colour name such as tomato.
2 Or pick a colour with the swatch, the sliders, or the screen eyedropper.
3 Read the RGB, HSL and OKLCH lines and copy whichever you need.
4 The line under the sliders names the closest CSS colour to whatever is set.
5 The contrast rows show how the colour holds up against white and black text.

Converting by hand means reading each pair of digits as a hexadecimal number. Two variants are worth recognising: the three-digit shorthand where each digit is doubled, so #e75 means #ee7755, and the eight-digit form where the final pair is alpha. The shorthand only works when both digits of each pair happen to match, which is why most real colours cannot be written short. The field also takes a name, and the named colours are a historical accident worth understanding before relying on them. They came from the X11 window system by way of early Netscape and were never designed as a coherent set: darkgray is lighter than gray, gray and grey are the same colour spelled two ways, there are four greens nowhere near each other in the colour space, and the coverage is wildly uneven: dozens of blues and almost no browns. The one deliberate addition is rebeccapurple, #663399, added to CSS in 2014 in memory of Eric Meyer’s daughter. For prototyping a name is fine; for designed work use the exact value, because the names are arbitrary and rarely the colour you meant.

What people use it for

  • Converting a hex code to RGB, HSL and OKLCH
  • Looking up what a CSS colour name resolves to
  • Finding which CSS colour name a hex code is closest to
  • Expanding a three-digit shorthand or reading an alpha pair
  • Checking a colour against white and black text before using it
  • Lifting a colour off the screen with the eyedropper
  • Reading a light-to-dark scale at the same hue

Questions

Read each pair of digits as a hexadecimal number. e0 is 224, 7a is 122, 5f is 95.

MDN, CSS color values
Was this tool any good?
Internal signal only · I use it to find the tools worth rebuilding