How to convert HEX to RGB by hand
A hex code is three pairs of base-16 digits: red, green, then blue. To convert a pair to a normal number, multiply the first digit by 16 and add the second. Letters stand for numbers: A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15.
For example, #FF5733:
| Channel | Hex pair | Math | Value |
|---|---|---|---|
| Red | FF | 15 × 16 + 15 | 255 |
| Green | 57 | 5 × 16 + 7 | 87 |
| Blue | 33 | 3 × 16 + 3 | 51 |
So #FF5733 is rgb(255, 87, 51).
Short and 8-digit hex codes
3-digit codes are shorthand: each digit is doubled. #F53 means #FF5533, and #FFF means #FFFFFF (white).
8-digit codes add transparency as a fourth pair. In #FF573380, the last pair 80 is 128, and 128 ÷ 255 ≈ 0.5, so it converts to rgba(255, 87, 51, 0.5): the same orange at 50% opacity. A 4-digit code like #F538 is the shorthand version.
Common colors in HEX and RGB
| Color | HEX | RGB |
|---|---|---|
| White | #FFFFFF | rgb(255, 255, 255) |
| Black | #000000 | rgb(0, 0, 0) |
| Red | #FF0000 | rgb(255, 0, 0) |
| Green (lime) | #00FF00 | rgb(0, 255, 0) |
| Blue | #0000FF | rgb(0, 0, 255) |
| Yellow | #FFFF00 | rgb(255, 255, 0) |
| Gray | #808080 | rgb(128, 128, 128) |
| Orange | #FFA500 | rgb(255, 165, 0) |
See every named color in the HTML color codes list.
Frequently asked questions
How do I convert a hex code to RGB?
Split the code into three pairs (red, green, blue) and convert each from base 16: first digit × 16 + second digit, where A–F mean 10–15. #FF5733 becomes rgb(255, 87, 51). Or paste the code into the converter above.
Are hex color codes case-sensitive?
No. #ff5733 and #FF5733 are the same color.
What does a 3-digit hex code mean?
It's shorthand where each digit is doubled: #F53 is #FF5533.
What is an 8-digit hex code?
The last two digits set transparency (alpha). 00 is fully transparent and FF is fully opaque, so #FF573380 is the color at about 50% opacity.
Why does my color look different when printed?
Screens mix light (RGB) while printers mix ink (CMYK), and some bright screen colors can't be printed exactly. The CMYK value shown is a standard conversion; for important print work, check with your printer.