RGB to HEX Converter
Convert RGB and RGBA color values to HEX color codes instantly in your browser.
Convert any RGB or RGBA color to a HEX code instantly with this free online RGB to HEX converter. Type values such as rgb(79, 70, 229) (or just 79, 70, 229), or pick a color with the swatch, and get the matching #4f46e5 hex code right away. It accepts plain comma-separated numbers, rgb() and rgba() strings, and an optional alpha channel that becomes an 8-digit hex — and everything runs in your browser with nothing to install.
What is an RGB to HEX converter?
An RGB to HEX converter turns red, green, and blue color values into a hexadecimal color code. RGB values use three numbers from 0 to 255 (one per channel), which are easy to read and tweak, while hex codes like #4f46e5 are compact and widely used in CSS, HTML, and design tools. This tool reads any valid RGB triplet and shows you the exact hex code behind it.
How to convert RGB to HEX
Each RGB channel (0 to 255) is converted to a two-digit base-16 number from 00 to ff, and the three pairs are joined after a # to form the hex code. For example, rgb(79, 70, 229) becomes #4f46e5 because 79 is 4f, 70 is 46, and 229 is e5. If you include an alpha value between 0 and 1, it is added as a fourth pair to produce an 8-digit hex code.
- Type or paste RGB values into the RGB field (rgb(...), rgba(...), or plain numbers all work).
- Read the HEX code and, when you add alpha, the 8-digit HEX, updated as you type.
- Use the color picker if you would rather choose a color visually.
- Click Copy to copy the format you need.
Why use this RGB to HEX converter?
- 100% free with no ads, sign-up, or limits.
- Instant conversion as you type.
- Accepts rgb(), rgba(), and plain comma-separated numbers.
- Outputs 6-digit hex, plus 8-digit hex when you include alpha.
- Runs entirely in your browser — your colors never leave your device.
Frequently asked questions
How do I convert an RGB color to HEX?
Convert each of the three channels (0 to 255) to a two-digit hexadecimal number and join them after a #. For example rgb(79, 70, 229) becomes #4f46e5. This tool does the math automatically.
What RGB formats does it accept?
You can paste rgb(79, 70, 229), rgba(79, 70, 229, 0.5), or just plain numbers like 79, 70, 229. Spaces, commas, and slashes between values all work.
Can it convert RGBA with transparency to hex?
Yes. When you include an alpha value between 0 and 1, the result also shows an 8-digit hex code where the last pair is the alpha channel, such as #4f46e580.
What is the difference between RGB and HEX?
They describe the same color in different ways. RGB uses three decimal numbers from 0 to 255, while HEX packs the same values into a base-16 string like #4f46e5. Most browsers and CSS accept both.