HEX to RGB Converter
HEX color code in, RGB out — with the working shown.
To convert HEX to RGB, split the hex into pairs, convert each pair from base 16, then read the result. For example, #2f81f7 in HEX is rgb(47 129 247) in RGB.
This is a free HEX to RGB converter. Type or paste any hexadecimal color code into the field above and the RGB value updates as you type, along with every other notation the web understands. RGB is three channels from 0 to 255 describing how hard the display drives its red, green and blue subpixels.
Conversions run entirely in your browser using the same color engine as the rest of the site: values round-trip through linear sRGB and CIE XYZ rather than through an approximation, so what you copy is accurate to the last digit the format can carry.
How to convert HEX to RGB
- Split the hex into pairs. Drop the leading # and split the six digits into three two-digit pairs: one each for red, green and blue.
- Convert each pair from base 16. Each pair is a hexadecimal number. Multiply the first digit by 16 and add the second, where a–f stand for 10–15.
- Read the result. The three results are your red, green and blue channels, each from 0 to 255.
Worked example: #2f81f7 converts to rgb(47 129 247). That color is Dodger Blue, and the tool above shows each intermediate step for whatever value you enter.
Common HEX to RGB values
The twenty colors people look up most often, converted from HEX to RGB. Every row is computed by the same engine as the tool above.
| Color | HEX | RGB |
|---|---|---|
| White | #ffffff | rgb(255 255 255) |
| Black | #000000 | rgb(0 0 0) |
| Red | #ff0000 | rgb(255 0 0) |
| Lime | #00ff00 | rgb(0 255 0) |
| Blue | #0000ff | rgb(0 0 255) |
| Yellow | #ffff00 | rgb(255 255 0) |
| Cyan | #00ffff | rgb(0 255 255) |
| Magenta | #ff00ff | rgb(255 0 255) |
| Silver | #c0c0c0 | rgb(192 192 192) |
| Gray | #808080 | rgb(128 128 128) |
| Maroon | #800000 | rgb(128 0 0) |
| Olive | #808000 | rgb(128 128 0) |
| Green | #008000 | rgb(0 128 0) |
| Purple | #800080 | rgb(128 0 128) |
| Teal | #008080 | rgb(0 128 128) |
| Navy | #000080 | rgb(0 0 128) |
| Orange | #ffa500 | rgb(255 165 0) |
| Pink | #ffc0cb | rgb(255 192 203) |
| Gold | #ffd700 | rgb(255 215 0) |
| Crimson | #dc143c | rgb(220 20 60) |
HEX and RGB, briefly
HEX is a six-digit hexadecimal number, two digits per channel, written with a leading #. Valid range: #000000 to #ffffff.
RGB is three channels from 0 to 255 describing how hard the display drives its red, green and blue subpixels. Valid range: 0–255 per channel.
Frequently asked questions
How do you convert HEX to RGB?
1. Drop the leading # and split the six digits into three two-digit pairs: one each for red, green and blue. 2. Each pair is a hexadecimal number. Multiply the first digit by 16 and add the second, where a–f stand for 10–15. 3. The three results are your red, green and blue channels, each from 0 to 255. The converter on this page does all of it as you type, and shows the working underneath.
What is #ff0000 in RGB?
Pure red, #ff0000, is rgb(255 0 0) in RGB. There is a table of twenty common colors converted to RGB further up this page.
What is #2f81f7 in RGB?
#2f81f7 converts to rgb(47 129 247). It is a dodger blue, and you can paste any other value into the field at the top of the page to convert it.
Is HEX to RGB conversion lossless?
Within sRGB, yes — converting to RGB and back returns the value you started with. The only rounding happens when a component is written out to a fixed number of decimal places.
Can I use RGB directly in CSS?
Yes. rgb(47 129 247) is valid CSS and works in every current browser.
Does this HEX to RGB converter support transparency?
Alpha is preserved wherever the target notation can carry it — eight-digit hex, rgb() / a, hsl() / a and the modern CSS spaces all round-trip an alpha channel. CMYK has no alpha, so it is dropped there.
Is my color data sent anywhere?
No. Every conversion on this site runs in your browser with no network request, no account and no analytics. You can disconnect and it keeps working.