Free RGB to HEX Converter
Convert RGB (or RGBA) values to a HEX color code, instantly and entirely in your browser.
How to convert RGB to HEX
-
1
Enter R, G and B
Type values from 0 to 255 for red, green and blue — or paste a full rgb()/rgba() string into the Red field.
-
2
Add alpha if needed
Optionally set an alpha value from 0 to 1 to get an 8-digit HEX code with transparency.
-
3
Copy the HEX code
Click "Copy" to grab the resulting HEX color for your CSS or design tool.
Example use cases
Converting a color picked from an image
Image editors often report a sampled color as RGB — convert it to HEX for use in CSS or a style guide.
Standardizing colors in a design system
Turn RGB values from a spec or export into consistent HEX codes for your CSS variables.
Encoding transparency into a single value
Combine RGB and an alpha value into one 8-digit HEX code instead of tracking opacity separately.
Frequently asked questions
What input formats work?
Type numbers directly into the R, G, B fields (0–255 each), and optionally an alpha value from 0 to 1. You can also paste a full rgb()/rgba() string into the Red field and it will be split automatically.
What does the alpha field do to the HEX output?
If you set an alpha below 1, the HEX output becomes an 8-digit code (#rrggbbaa) with the alpha encoded as the last two digits. Leave it blank for a standard 6-digit HEX.
Is my input uploaded anywhere?
No. The conversion happens locally in your browser using JavaScript — nothing you type is sent to a server.
I need to go the other way — HEX to RGB
Use the dedicated HEX to RGB Converter, or the combined Color Converter which handles HEX, RGB and HSL in both directions.