RGB to HEX Converter
Convert rgb() or rgba() values to a hex color code. Accepts CSS notation and bare numbers like 59, 130, 246, and returns hex with or without alpha.
RGB color
Hexadecimal values
Enter a color value to see the result.
How RGB and hex colors relate
An RGB colour lists the red, green and blue channels as decimal numbers from 0 to 255. A hex colour stores the same three channels as two hexadecimal digits each, so rgb(59, 130, 246) and #3B82F6 describe exactly the same blue.
When a colour has transparency, CSS writes it as rgba() with a fourth value between 0 and 1, while hex appends a fourth pair for the alpha channel. The converter shows both, so you can pick the form your code needs.
How to convert RGB to hex
- Paste an rgb() or rgba() value, or type the three numbers separated by commas.
- Press Convert to HEX.
- Check the preview swatch and the HEX or HEX8 output.
- Copy the hex code you need, or use the RGB and RGBA rows to confirm the values were read correctly.
RGB to hex examples
Standard rgb() value
rgb(59, 130, 246)
#3B82F6
rgba() with transparency
rgba(59, 130, 246, 0.5)
#3B82F680
Plain comma separated numbers
255, 255, 255
#FFFFFF
UrsaKit vs other RGB to hex converters
| Dimension | UrsaKit | rgbtohex.net | HTML Color Codes |
|---|---|---|---|
| Price | Free | Free | Free with ads |
| Bare number input | Yes | Partial | No |
| Alpha handling | Yes, rgba() to hex8 | Partial | Yes |
| Copy individual values | Yes | No | Partial |
| Preview swatch | Yes | Yes | Yes |
| Uploads your color | No | No | No |
Frequently asked questions
Can I type just the numbers without rgb()?
Yes. 59, 130, 246 is parsed the same way as rgb(59, 130, 246), and numbers can be separated by commas or spaces.
How is alpha converted?
The 0 to 1 alpha value is multiplied by 255 and written as the fourth hex pair, so rgba(59, 130, 246, 0.5) becomes #3B82F680.
What is the difference between HEX and HEX8?
HEX is the six digit code for the colour. HEX8 adds two digits for the alpha channel and is only needed when the colour is partly transparent.
What numbers are valid?
Each channel must be a whole number from 0 to 255, and alpha must be between 0 and 1 or a percentage from 0% to 100%.
Is my input uploaded?
No. The conversion runs in your browser with JavaScript and nothing is sent to a server.
Can I go back from hex to RGB?
Yes. Use the hex to RGB converter linked below to turn a hex code into rgb() or rgba() values.