Galham › HEX → RGB

HEX to RGB Converter

Paste a HEX code to get its RGB value instantly. Works with 6-digit codes like #4F46E5, 3-digit shorthand like #FFF, and 8-digit codes with transparency.

How the conversion works

A HEX code is three pairs of base-16 digits: one pair each for red, green and blue. Converting each pair to a number from 0 to 255 gives you the RGB value.

#4F46E5 → 4F = 79, 46 = 70, E5 = 229 → rgb(79, 70, 229)

Common colours

ColourHEXRGB
White#FFFFFFrgb(255, 255, 255)
Black#000000rgb(0, 0, 0)
Red#FF0000rgb(255, 0, 0)
Lime#00FF00rgb(0, 255, 0)
Blue#0000FFrgb(0, 0, 255)
Yellow#FFFF00rgb(255, 255, 0)
Cyan#00FFFFrgb(0, 255, 255)
Magenta#FF00FFrgb(255, 0, 255)
Grey#808080rgb(128, 128, 128)
Silver#C0C0C0rgb(192, 192, 192)
Orange#FFA500rgb(255, 165, 0)
Purple#800080rgb(128, 0, 128)
Navy#000080rgb(0, 0, 128)
Teal#008080rgb(0, 128, 128)
Maroon#800000rgb(128, 0, 0)
Olive#808000rgb(128, 128, 0)
Green#008000rgb(0, 128, 0)
Pink#FFC0CBrgb(255, 192, 203)
Brown#A52A2Argb(165, 42, 42)
Gold#FFD700rgb(255, 215, 0)

Common questions

How do I convert HEX to RGB?

Split the six digits into three pairs and convert each pair from base 16 to a number from 0 to 255. Or paste the code into the box above and Galham does it for you.

What does a 3-digit HEX code mean?

It's shorthand where each digit is doubled. #F0A is the same as #FF00AA, which is rgb(255, 0, 170).

Can HEX include transparency?

Yes. An 8-digit code adds a fourth pair for alpha (opacity). #4F46E580 is the indigo above at about 50% opacity, which is rgba(79, 70, 229, 0.5). All modern browsers support it in CSS.

Keep going with this colour

More Galham tools