HEX to RGB Converter
Paste a HEX color code to get its RGB and RGBA values.
3, 4, 6 or 8 digits, with or without #. 4 and 8 digits include alpha.
rgb(30, 144, 255)
- RGB
- rgb(30, 144, 255)
- RGBA
- rgba(30, 144, 255, 1)
- ValuesR, G, B
- 30, 144, 255
- HEXnormalized
- #1E90FF
- HSL
- hsl(210, 100%, 55.9%)
Going the other way? Use the RGB to HEX converter.
How to convert HEX to RGB
- Type or paste a HEX code such as
#1E90FF,1e90ffor#F80. - The RGB and RGBA values update as you type, with a preview of the color.
- Copy the CSS value you need, or just the three numbers.
How the conversion works
A HEX color is three bytes written in base 16. Each pair of digits is one channel: red, green, then blue. Converting to RGB means reading each pair as a number from 0 to 255.
1E → 1 × 16 + 14 = 30 (red)
90 → 9 × 16 + 0 = 144 (green)
FF → 15 × 16 + 15 = 255 (blue)With 8 digits, the last pair is alpha: #1E90FF80 becomes rgba(30, 144, 255, 0.502), because 80 in hex is 128 and 128 ÷ 255 ≈ 0.502. Short 3- and 4-digit codes double each digit first.
Features
- Accepts 3, 4, 6 and 8-digit HEX, with or without the #, in any letter case.
- Shows
rgb(),rgba(), plain values and HSL. - Explains mistakes — like a letter G or a 5-digit code — instead of guessing.
Common HEX colors in RGB
| Swatch | HEX | RGB |
|---|---|---|
| #000000 | rgb(0, 0, 0) | |
| #FFFFFF | rgb(255, 255, 255) | |
| #FF0000 | rgb(255, 0, 0) | |
| #00FF00 | rgb(0, 255, 0) | |
| #0000FF | rgb(0, 0, 255) | |
| #FFFF00 | rgb(255, 255, 0) | |
| #00FFFF | rgb(0, 255, 255) | |
| #FF00FF | rgb(255, 0, 255) | |
| #808080 | rgb(128, 128, 128) | |
| #FFA500 | rgb(255, 165, 0) | |
| #800080 | rgb(128, 0, 128) | |
| #1E90FF | rgb(30, 144, 255) |
Related color tools
Convert the other way with RGB to HEX, pick new colors with the color picker, or look up names in the HTML color codes list.
Frequently asked questions
- How do I convert HEX to RGB by hand?
- Split the six digits into three pairs and convert each pair from base 16 to base 10. For #1E90FF: 1E = 30, 90 = 144, FF = 255, so the color is rgb(30, 144, 255).
- What about 3-digit HEX codes?
- Each digit is doubled: #F80 is the same as #FF8800, which is rgb(255, 136, 0). The converter expands short codes automatically.
- How do 8-digit HEX codes work?
- The last two digits are the alpha (opacity) channel, from 00 (transparent) to FF (opaque). #1E90FF80 is rgba(30, 144, 255, 0.502). 4-digit codes work the same way with single digits.
- Is HEX case-sensitive?
- No. #1e90ff and #1E90FF are the same color in CSS, HTML and this converter.