HEX to RGB converter
Similar colors
Convert HEX to RGB online
Paste a HEX code with or without the # sign, three or six characters long. The RGB numbers appear next to it, ready to copy.
How to convert HEX to RGB
- Split the code into three pairs. The first is red, the second is green and the third is blue.
- In each pair, multiply the first character by 16 and add the second. A to F stand for 10 to 15.
- Example: in #4169E1, 41 is 4 x 16 + 1 = 65, 69 is 6 x 16 + 9 = 105, and E1 is 14 x 16 + 1 = 225. So it is RGB 65, 105, 225.
const hexToRgb = hex =>
hex.replace('#', '').match(/../g).map(pair => parseInt(pair, 16));
hexToRgb('#4169E1'); // [65, 105, 225]HEX to RGB table of common colors
| Color | HEX | RGB |
|---|---|---|
| Black | #000000 | 0, 0, 0 |
| White | #FFFFFF | 255, 255, 255 |
| Gray | #808080 | 128, 128, 128 |
| Red | #FF0000 | 255, 0, 0 |
| Maroon | #800000 | 128, 0, 0 |
| Orange | #FFA500 | 255, 165, 0 |
| Gold | #FFD700 | 255, 215, 0 |
| Yellow | #FFFF00 | 255, 255, 0 |
| Green | #008000 | 0, 128, 0 |
| Teal | #008080 | 0, 128, 128 |
| Cyan | #00FFFF | 0, 255, 255 |
| Blue | #0000FF | 0, 0, 255 |
| Navy Blue | #000080 | 0, 0, 128 |
| Purple | #800080 | 128, 0, 128 |
| Magenta | #FF00FF | 255, 0, 255 |
| Pink | #FFC0CB | 255, 192, 203 |
Frequently asked questions
What does a three-character HEX code mean?
It is a short form: every character is doubled. #F60 is the same as #FF6600, or RGB 255, 102, 0.
Does capitalization matter in HEX codes?
No. #ffb6c1 and #FFB6C1 are the same color.
Which one should I use in CSS, HEX or RGB?
Browsers treat them the same. HEX is shorter, while rgb() is easier to read and lets you add opacity, as in rgb(65 105 225 / 50%).