Paste a hex code to get its red, green and blue values, with every step of the conversion shown.
3, 4, 6 or 8 digits, with or without the #. A fourth pair is read as opacity.
How these values are worked out
Going the other way? Use RGB to hex. For HSL, CMYK and the other codes of a color, type it into the color picker.
Hexadecimal counts in sixteens, so it has sixteen digits. After 9 come the letters A to F. Two hex digits cover every value from 0 to 255: 00 is 0 and FF is 15 × 16 + 15 = 255.
| Hex digit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Value | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| Color | Hex | RGB |
|---|---|---|
| Black | #000000 | 0, 0, 0 |
| Gray | #808080 | 128, 128, 128 |
| Silver | #C0C0C0 | 192, 192, 192 |
| White | #FFFFFF | 255, 255, 255 |
| Maroon | #800000 | 128, 0, 0 |
| Red | #FF0000 | 255, 0, 0 |
| Olive | #808000 | 128, 128, 0 |
| Yellow | #FFFF00 | 255, 255, 0 |
| Green | #008000 | 0, 128, 0 |
| Lime | #00FF00 | 0, 255, 0 |
| Teal | #008080 | 0, 128, 128 |
| Aqua (cyan) | #00FFFF | 0, 255, 255 |
| Navy (navy blue) | #000080 | 0, 0, 128 |
| Blue | #0000FF | 0, 0, 255 |
| Purple | #800080 | 128, 0, 128 |
| Fuchsia | #FF00FF | 255, 0, 255 |
Split the six digits into three pairs: red, green and blue. In each pair, multiply the first digit by 16 and add the second, counting A to F as 10 to 15. #FFA500 gives 255, 165 and 0, so it is rgb(255, 165, 0).
rgb(255, 255, 255), which is white. #000000 is rgb(0, 0, 0), which is black.
Double each digit first. #FA0 becomes #FFAA00, which is rgb(255, 170, 0).
The last pair is the opacity, also called alpha. 00 is fully see-through and FF is solid. #FFA50080 is orange at about 50% opacity, because 80 in hex is 128 and 128 out of 255 is about half.
No. A hex code and its RGB value hold the same three numbers, one counted in sixteens and one in tens. You can convert back and forth as often as you like.
The values 10 to 15. Hexadecimal counts in sixteens, so it needs six digits more than the usual ten.
As rgb(255, 165, 0) or, in the newer form without commas, rgb(255 165 0). With transparency, add the opacity after a slash: rgb(255 165 0 / 50%).
Divide each value by 255. Some design and 3D tools want colors this way: rgb(255, 165, 0) becomes 1, 0.647, 0.