Hex to RGB
Paste a hex code and get its red, green and blue values, along with every other way the same color can be written. An rgb() or hsl() string works too. Everything is worked out in your browser, so nothing is sent anywhere.
Convert hex to RGB
Click any code to copy it.
rgb(15, 82, 186)
| HEX | |
|---|---|
| RGB | |
| HSL | |
| HSV / HSB | |
| CMYK | |
| HWB | |
| LAB | |
| LCH | |
| LUV | |
| XYZ |
Common questions
- How do you convert hex to RGB?
- Split the six characters into three pairs. Each pair is a hexadecimal number: multiply the first digit by 16 and add the second, counting A as 10 through to F as 15. So BA is 11 times 16 plus 10, which is 186. The three results are the red, green and blue values in order.
- What is #0F52BA in RGB?
- It is rgb(15, 82, 186). 0F is 15, 52 is 82 and BA is 186. That colour is commonly called sapphire.
- What does a three-digit hex code mean?
- It is shorthand. A browser expands each digit by doubling it, so #F0C becomes #FF00CC and #FFF becomes #FFFFFF. It only works when both digits of every pair are the same, which is why most colours cannot be shortened.
- What about eight-digit hex codes?
- The last two digits are the alpha channel, or opacity. FF is fully opaque and 00 is fully transparent, so #0F52BA80 is sapphire at roughly 50 percent. Four-digit codes are the shorthand version of the same thing.
- Is hex or RGB better to use in CSS?
- Neither is better and both compile to the same colour. Hex is shorter to type and dominates design tools. rgb() is easier to read channel by channel and easier to change programmatically, which is why generated stylesheets tend to prefer it.
More color tools
All toolsShare