Hex to RGB Converter
Paste a hex code, with or without the #, and the matching rgb() value appears right away. Three-digit shorthand such as #F80 works too. Copy the result straight into your CSS or design tool.
#1E90FFexactly dodgerblue
Use 3 or 6 digits, for example #1E90FF or 19F
For example rgb(30, 144, 255) or 30 144 255
This is the CSS color dodgerblue #1E90FF
Pick visually and see the other formats
For example hsl(210, 100%, 56%)
For example cmyk(88%, 44%, 0%, 0%)
Recent colors
Colors you pick appear here. They stay on this device.
By the Hex Color Picker Team. Updated
How to convert hex to RGB
- Type or paste the hex code into the hex box. You can include the # or leave it out.
- Copy the rgb() value from the RGB box.
- The conversion also works backwards: edit the RGB box and the hex code follows.
The math, step by step
Split the six digits into three pairs: red, green and blue. Each pair is a base-16 number, so the first digit counts sixteens and the second counts ones. The letters A to F stand for 10 to 15.
For #1E90FF the pairs are 1E, 90 and FF. 1E is 1 x 16 + 14 = 30. 90 is 9 x 16 + 0 = 144. FF is 15 x 16 + 15 = 255. The result is rgb(30, 144, 255), the CSS color dodgerblue.
Shorthand hex codes
A three-digit code repeats each digit to make the full six-digit code. #F80 means #FF8800, which is rgb(255, 136, 0). The shortcut only works when every pair is two identical digits, so #1E90FF can't be shortened.
Why designers need both formats
Hex is the compact way to store a color in a stylesheet or a brand guide. RGB is easier when you need to do something with the numbers: apply opacity with rgb(30 144 255 / 50%), animate one channel in JavaScript, or feed a color into canvas code. Converting between them loses nothing, so you can keep whichever suits the job.
Reading a hex code at a glance
You can estimate a color's RGB makeup before converting. A pair of FF means that channel is at full strength and 00 means it is off, so #FF0000 is pure red and #00FF00 is pure green. When all three pairs match, as in #808080, the color is a grey. Higher pairs mean more light, so #FFFFFF is white and #000000 is black. Pairs in the middle, like 80, are about half strength, since 80 hex is 128 out of 255. A quick glance like this helps you spot a typo in a code before you paste it.
Common questions
Does the hex code need the # symbol?
Not here. The converter accepts the code with or without the # and returns a standard rgb() value.
What if my hex code has 8 digits?
Eight-digit codes add transparency in the last two digits. This converter handles standard opaque 3 and 6 digit codes; drop the last two digits to convert the color itself.