Convert hex color codes to RGB, with HSL, OKLCH and CMYK values alongside.
Enter a valid Hex value, like #8B5CF6
A hex code holds three numbers, one each for red, green and blue, written in base 16. Each pair of digits gives a value from 0 to 255:
#8B5CF6
R = 8B = 8 × 16 + 11 = 139
G = 5C = 5 × 16 + 12 = 92
B = F6 = 15 × 16 + 6 = 246So #8B5CF6, Tailwind's violet-500, is rgb(139, 92, 246). Letters A to F stand for 10 to 15.
| Color | Hex | RGB |
|---|---|---|
| White | #FFFFFF | rgb(255, 255, 255) |
| Black | #000000 | rgb(0, 0, 0) |
| Red | #FF0000 | rgb(255, 0, 0) |
| Orange | #FFA500 | rgb(255, 165, 0) |
| Yellow | #FFFF00 | rgb(255, 255, 0) |
| Green | #008000 | rgb(0, 128, 0) |
| Blue | #0000FF | rgb(0, 0, 255) |
| Purple | #800080 | rgb(128, 0, 128) |
| Pink | #FFC0CB | rgb(255, 192, 203) |
| Gray | #808080 | rgb(128, 128, 128) |
Paste the hex code above and the RGB value appears instantly. By hand, split the six digits into three pairs and turn each pair from base 16 into a number from 0 to 255. #8B5CF6 becomes 8B, 5C and F6, which is 139, 92 and 246.
Each digit is doubled, so #FA0 is the same as #FFAA00. The converter accepts both short and full codes, with or without the #.
Yes. A hex code is just RGB written in base 16, so converting between them never changes the color. Pick whichever format your code or design tool expects.
Use rgb(139 92 246 / 50%) in modern CSS, or rgba(139, 92, 246, 0.5) in the older syntax. In hex, add two more digits for the alpha, like #8B5CF680 for about 50%.