HEX to RGB

Convert any HEX color code like #8997BB to its RGB value, rgb(137, 151, 187), for CSS, design apps and code. Free HEX to RGB converter.

Turn a HEX color into RGB

HEX and RGB describe the same colors in two notations. A HEX code like #8997BB is three pairs of hexadecimal digits for red, green and blue. RGB writes the same amounts as ordinary numbers from 0 to 255: rgb(137, 151, 187).

Paste a HEX code and this converter returns the RGB value. That's what you'll need for many design and charting tools, for adding transparency with rgba(), and for code that works with color channels separately.

The math is simple but tedious: each pair is converted from base 16 to base 10. 89 in hex is 8×16 + 9 = 137.

How to use the hex to rgb

  1. Enter the HEX color starting with #, for example #8997BB. Without the # the tool can't tell it's a HEX code and shows an error.
  2. Submit to convert.
  3. Copy the RGB value.

Examples

Brand periwinkle

Input: #8997BB

Output: rgb(137,151,187)

Lavender

Input: #C6CDE5

Output: rgb(198,205,229)

Three-digit shorthand

Input: #fa0

Output: rgb(255,170,0)

Each digit is doubled: #fa0 is #ffaa00.

Eight-digit HEX with alpha

Input: #8997BB80

Output: rgba(137,151,187,0.5)

The rgb() row ignores the alpha, but the rgba() row keeps it: 80 in hex is 128 of 255, shown as 0.5. The HEXA row then reads #8997bb7f, because 0.5 converts back to 127 (7f).

Every format at once

Input: #8997BB

Output:

rgb(137,151,187)
hsl(223,27%,64%)
hsv(223,27%,73%)
rgba(137,151,187,1)
#8997bbff

One conversion gives you RGB, HSL, HSV, RGBA and eight-digit HEXA, so you can copy whichever your app expects.

Common uses

  • Converting brand colors for design tools that use RGB.
  • Writing rgba() colors with transparency in CSS.
  • Setting colors in code, charts or Office documents.
  • Matching colors across apps.
  • Entering brand colors into apps that only accept RGB, such as some video editors and office programs.
  • Setting a semi-transparent overlay in CSS with rgba().
  • Using HSL to make a lighter or darker shade of the same hue.

Tips and things to know

  • Three-digit HEX like #FFF expands to #FFFFFF, which is rgb(255, 255, 255).
  • To add transparency, use rgba(137, 151, 187, 0.5) for 50% opacity.
  • For every other format (HSL, HSV and more), use the color converter. To go back, use RGB to HEX.

Edge cases and limitations

  • The # is required. 8997BB on its own is rejected.
  • The output has no spaces after the commas. Both rgb(137,151,187) and rgb(137, 151, 187) are valid CSS.
  • Invalid digits (anything other than 0–9 and A–F) produce an error rather than a guess.
  • Four-digit shorthand with alpha (#f008) isn't supported; expand it to eight digits.

Frequently asked questions

How do I convert HEX to RGB?

Split the HEX code into three pairs and convert each from base 16 to base 10. #FF8000 becomes 255, 128, 0.

Is HEX the same as RGB?

They describe the same colors; HEX is just a compact hexadecimal way of writing the RGB values.

What is #000000 in RGB?

rgb(0, 0, 0), which is black.

Can HEX include transparency?

Yes, eight-digit HEX adds alpha as the last pair, for example #8997BB80.

What do the HSL and HSV values mean?

Both describe hue (the color angle, 0–360), saturation and either lightness (HSL) or value/brightness (HSV). Changing only the last number gives a lighter or darker version of the same color.

Related tools

  • RGB to HEX: Easily convert RGB color units to HEX with this easy convertor.
  • Color converter: Convert your color to multiple other formats.
  • Color picker: The easiest way to select a color from the color wheel and get the results in any format.
  • Hex converter: Convert text to hexadecimal and the other way for any string input.
  • Image optimizer: Compress and optimize images for a smaller image size but still high quality.

Similar tools

RGB to HEX

Convert RGB color values like rgb(137, 151, 187) into a HEX code (#8997BB) for CSS, HTML, design tools and brand guides. Free RGB to HEX converter.

Popular free tools