Hex to RGB Converter

Type or paste a hex code to get its RGB value. Click any result to copy it.

How to convert hex to RGB

A hex code is three pairs of base-16 digits: the first pair is red, the second green, the third blue. Turn each pair into a normal number from 0 to 255 and you have the RGB value. Hex digits run 0 to 9, then A (10) through F (15).

#ACF742 splits into AC, F7 and 42
AC = 10 × 16 + 12 = 172
F7 = 15 × 16 + 7 = 247
42 = 4 × 16 + 2 = 66
Result: rgb(172, 247, 66)

Short and 8-digit hex codes

A 3-digit code doubles each digit, so #FA3 is #FFAA33, or rgb(255, 170, 51). An 8-digit code adds a fourth pair for opacity: #ACF74280 ends in 80, which is 128 out of 255, so it means rgb(172, 247, 66) at about 50% opacity. The converter accepts every length and shows the rgba() value when a code includes transparency.

Common hex colors in RGB

Select a color name to see its full ColorKit page, or use Load to put it in the converter.

ColorHexRGBLoad into the converter
Black#000000rgb(0, 0, 0)
White#FFFFFFrgb(255, 255, 255)
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)
Silver#C0C0C0rgb(192, 192, 192)
Gray#808080rgb(128, 128, 128)
Maroon#800000rgb(128, 0, 0)
Olive#808000rgb(128, 128, 0)
Green#008000rgb(0, 128, 0)
Purple#800080rgb(128, 0, 128)
Teal#008080rgb(0, 128, 128)
Navy#000080rgb(0, 0, 128)
Orange#FFA500rgb(255, 165, 0)
Pink#FFC0CBrgb(255, 192, 203)
Brown#A52A2Argb(165, 42, 42)
Gold#FFD700rgb(255, 215, 0)

Hex or RGB: which should you use?

They describe exactly the same 16.7 million colors, so converting between them never loses anything. Hex is shorter and is what most design tools show you. RGB is easier to read and tweak by hand, and in CSS you can add transparency right inside it, like rgb(172 247 66 / 50%).

Hex to RGB questions

What is #FFFFFF in RGB?

White: rgb(255, 255, 255). Black, #000000, is rgb(0, 0, 0).

Is any precision lost converting hex to RGB?

No. Both store each channel as a whole number from 0 to 255, so every hex code has exactly one RGB value and converting back gives the same code. If you need values from 0 to 1 for code or a shader, the converter lists those too.

Can I go the other way?

Yes. The RGB to hex converter turns three numbers back into a hex code. For print colors, use the hex to CMYK converter.

Want to pick a color first? The color picker shows every format at once, and the hex color codes guide explains how the notation works.