HEX to RGB Converter
Convert any HEX color code to RGB instantly, or move the RGB sliders to get the HEX code. Preview the color, check its contrast and copy the result in one click.
HEX and RGB color converter
#2458E8rgb(36, 88, 232)hsl(224, 81%, 53%)36, 88, 232–
–
Try a Common Color
Click a color to load it into the converter.
How to Convert HEX to RGB
A HEX color code is made of three pairs of hexadecimal digits: RR, GG and BB. Each pair is a number from 00 to FF, which equals 0 to 255 in decimal, the same range as an RGB value.
To convert a pair, multiply the first digit by 16 and add the second digit. Letters count as numbers: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
24 → (2 × 16) + 4 = 36 (red)
58 → (5 × 16) + 8 = 88 (green)
E8 → (14 × 16) + 8 = 232 (blue)
Result:
rgb(36, 88, 232)Short HEX codes
A 3-digit HEX code is a shortcut: each digit is doubled. #F80 means #FF8800, which is rgb(255, 136, 0).
HEX codes with transparency
An 8-digit HEX code adds a fourth pair for opacity (alpha). #2458E880 becomes rgba(36, 88, 232, 0.502), because 80 in HEX is 128, and 128 ÷ 255 ≈ 0.502 (about 50% opacity). The converter shows the RGBA value automatically when you enter 4 or 8 digits.
How to Convert RGB to HEX
Do the reverse: divide each RGB value by 16. The whole number is the first HEX digit and the remainder is the second. For example, 232 ÷ 16 = 14 remainder 8, so 232 becomes E8. Put the three pairs together after a #. You can also simply move the RGB sliders above and copy the HEX code.
255 ÷ 16 = 15 remainder 15 → F and F → FF (red)
136 ÷ 16 = 8 remainder 8 → 8 and 8 → 88 (green)
0 ÷ 16 = 0 remainder 0 → 0 and 0 → 00 (blue)
Result:
#FF8800HEX to RGB Chart
| Color | HEX | RGB |
|---|---|---|
| Black | #000000 | rgb(0, 0, 0) |
| White | #FFFFFF | rgb(255, 255, 255) |
| Red | #FF0000 | rgb(255, 0, 0) |
| Lime | #00FF00 | rgb(0, 255, 0) |
| Blue | #0000FF | rgb(0, 0, 255) |
| Yellow | #FFFF00 | rgb(255, 255, 0) |
| Cyan | #00FFFF | rgb(0, 255, 255) |
| Magenta | #FF00FF | rgb(255, 0, 255) |
| Gray | #808080 | rgb(128, 128, 128) |
| Orange | #FFA500 | rgb(255, 165, 0) |
| Purple | #800080 | rgb(128, 0, 128) |
| Navy | #000080 | rgb(0, 0, 128) |
Frequently Asked Questions
What is the difference between HEX and RGB?
They describe the same color in two formats. RGB writes the red, green and blue values as numbers from 0 to 255, like rgb(255, 0, 0). HEX writes the same values in base 16, like #FF0000.
Can every HEX code be converted to RGB?
Yes. Every valid 3- or 6-digit HEX code has exactly one RGB equivalent, and the conversion works both ways without losing any information. 4- and 8-digit HEX codes also contain transparency (alpha): the last digit or pair sets the opacity, so they convert to an RGBA value, such as #FF880080 → rgba(255, 136, 0, 0.502).
Is the # symbol required?
No. You can type 2458E8 or #2458E8; the converter accepts both, in uppercase or lowercase.
Which format should I use in CSS?
Both work in every modern browser. HEX is shorter, while rgb() and rgba() are easier to read and adjust, especially when you need transparency.
