What is the relationship between HEX and RGB?
HEX and RGB describe the same colors in two notations. RGB lists the amount of red, green and blue as three numbers from 0 to 255. A hex code writes those same three numbers in base 16, two characters each, after a # sign.
So #5B4FF0 splits into 5B, 4F and F0. Converting each pair from base 16: 5B is 5 x 16 + 11 = 91, 4F is 4 x 16 + 15 = 79, and F0 is 15 x 16 + 0 = 240. That gives rgb(91, 79, 240).
The tool also accepts the three-digit shorthand, where each character is doubled, so #fa0 is read as #ffaa00.
Why you might need the RGB form
Hex codes dominate design handoffs and brand guides, but plenty of places want separate channel values: image editors, game engines, charting libraries, and CSS functions such as rgb() or rgba() when you need to add transparency.
Converting is also the first step if you want to adjust one channel by a specific amount, because it is far easier to add 20 to a number than to edit a base-16 pair in your head.
If you need to go the other way, use the RGB to HEX converter. For hue-based editing, the HEX to HSL converter is the better fit.
How to convert a HEX code to RGB
- Type or paste the code into the HEX color text box. The default is #5B4FF0, and the leading # is optional.
- Alternatively, click the small color swatch next to the box to pick a color visually. The text box updates to its hex value.
- Read the result in the panel below, written as rgb(r, g, b), and check the preview swatch to confirm it is the color you meant.
Worked example: #FF8800 gives FF = 255, 88 = 8 x 16 + 8 = 136, and 00 = 0. The result is rgb(255, 136, 0), a bright orange.
The tool runs in your browser, so your values stay on your device. There is no copy button, so select the displayed text to copy it.
Mistakes to avoid
The converter only handles six-digit codes and the three-digit shorthand. An eight-digit code with an alpha channel (such as #5B4FF0CC) is not valid input here, and you will see a prompt to enter a valid 6-digit hex color instead.
Typos are the usual cause of that message. Hex digits only run from 0 to 9 and A to F, so a G or an O will not parse. Letter case does not matter.
Remember that the picker shows only fully opaque colors. If your design needs transparency, convert the color first and add the alpha value yourself when you write the rgba() CSS.