HEX to RGB Converter

Convert a hex color code to RGB and RGBA values with a preview swatch. Accepts 3, 4, 6 and 8 digit codes such as #3B82F6 or #3B82F680.

Hexadecimal color

RGB and RGBA values

Enter a color value to see the result.

HEX to RGB Converter

What is a hex color code?

A hex color code writes the red, green and blue channels as two hexadecimal digits each, so #3B82F6 means red 3B, green 82 and blue F6. Hexadecimal is base 16, which is why the channels run from 00 to FF, the equivalent of 0 to 255.

CSS also accepts four and eight digit codes: the extra pair is the alpha channel, so #3B82F680 is the same blue at about 50% opacity. Three and four digit shorthand such as #abc doubles each digit, giving #aabbcc.

How to convert hex to RGB

  1. Paste a hex color code with or without the leading #.
  2. Press Convert to RGB.
  3. Read the red, green and blue values in the result panel, plus the alpha channel when the code has one.
  4. Copy the rgb() or rgba() value with the copy buttons, or grab the plain channel numbers from the cards.

Hex to RGB examples

Standard six digit blue

#3B82F6
rgb(59, 130, 246)

Three digit shorthand white

#FFF
rgb(255, 255, 255)

Eight digit blue with alpha

#3B82F680
rgba(59, 130, 246, 0.5)

UrsaKit vs other hex to RGB converters

DimensionUrsaKitrgbtohex.netHTML Color Codes
PriceFreeFreeFree with ads
Live preview swatchYesYesYes
Alpha channelYes, 4 and 8 digitPartialYes
Copy individual valuesYesNoPartial
Other color modelsSeparate toolsNoRGB, HSL, CMYK
Uploads your colorNoNoNo
FAQ

Frequently asked questions

Does the converter accept hex codes without a #?

Yes. Both 3B82F6 and #3B82F6 work, and the leading hash is added back to the normalised output.

What is the difference between rgb() and rgba()?

rgb() takes three channels and is fully opaque. rgba() adds a fourth alpha value between 0 and 1, which is used when the hex code has four or eight digits.

How do 3 and 4 digit hex codes work?

Each digit is doubled, so #abc becomes #aabbcc and #abcd becomes #aabbccdd. This is a CSS shorthand for colours where both digits of every channel match.

What do the RGB numbers mean?

Each channel is a value from 0 to 255: 0 means none of that light, 255 means the full channel. Mixing the three channels produces the final colour.

Is my colour sent to a server?

No. The conversion happens in your browser with JavaScript, so nothing is uploaded.

Can I convert the other way, from RGB to hex?

Yes. Use the RGB to hex tool, which is linked below, to go from rgb() or rgba() values back to a hex code.

All Tools