RGBA to HEX Converter
Convert RGBA to HEX, including transparency. Get the 8-digit hex code (#RRGGBBAA), or a solid 6-digit hex code that matches how the color looks on white or black.
Paste rgba() or rgb(r g b / a), or enter the four values below. Hex, hsl() and oklch() also work.
| On white | | |
|---|---|---|
| On black | |
The opaque color you see when the transparent color sits on that background. Useful where transparency is not supported.
| HEX | | |
|---|---|---|
| HEX + alpha | | |
| RGB | | |
| RGBA | | |
| HSL | | |
| OKLCH | | |
| Tailwind | |
Convert RGBA Colors to HEX Online
Transparent colors are often written as rgba(), but design tokens, Figma variables and some apps want a hex code. This RGBA to HEX converter gives you the 8-digit hex code that keeps the transparency, so the color looks exactly the same.
If the place you paste the color into does not support transparency, use the solid hex code instead: it is the color you actually see when the transparent color sits on a white or black background.
How to convert RGBA to HEX
- Enter the RGBA color, such as
rgba(79, 70, 229, 0.5), or type the red, green, blue and alpha values into the fields. - Copy the 8-digit hex code, for example
#4F46E580. It keeps the transparency. - Need a solid color? Copy the "On white" or "On black" hex code instead.
How the alpha becomes the last two hex digits
The red, green and blue values convert to hex pairs as usual (79 → 4F, 70 → 46, 229 → E5). The alpha is a number from 0 to 1, so it is first multiplied by 255 and rounded: 0.5 × 255 = 127.5 → 128, which is 80 in hex. Put it at the end and you get #4F46E580.
| Alpha | × 255 | Hex |
|---|---|---|
| 1 | 255 | FF |
| 0.75 | 191 | BF |
| 0.5 | 128 | 80 |
| 0.25 | 64 | 40 |
| 0.1 | 26 | 1A |
| 0 | 0 | 00 |
Converting RGBA to a solid 6-digit hex
A 6-digit hex code cannot store transparency. To get the solid color a transparent color produces on a background, each channel is mixed with the background: result = color × alpha + background × (1 − alpha).
For rgba(79, 70, 229, 0.5) on white that gives #A7A3F2, and on black #282373. These are handy for emails, older software, image editors and anywhere else transparency is ignored.
Where 8-digit hex codes work
- Browsers: all current versions of Chrome, Edge, Firefox and Safari support
#RRGGBBAAand the short#RGBAform in CSS. - Design tools: Figma and most modern design tools show and accept 8-digit hex.
- Watch out: Android color resources use
#AARRGGBB, with the alpha first. Move the last two digits to the front for Android XML. - Email: many email clients ignore transparency. Use the solid hex code there.
Frequently Asked Questions
Common questions about converting RGBA colors to hex.
Convert red, green and blue to hex pairs, multiply the alpha by 255, convert it to hex and add it at the end. rgba(79, 70, 229, 0.5) becomes #4F46E580.
No. A 6-digit hex code is always fully opaque. Use an 8-digit code for transparency, or a solid color blended on the background you use.
rgba(0, 0, 0, 0.5) is #00000080. On a white background it looks like #808080.
The alpha is stored out of 255, not out of 100. 50% of 255 is 128, which is 80 in hex.
No. Android uses #AARRGGBB, with the alpha first. #4F46E580 in CSS is #804F46E5 on Android.
No. The conversion runs in your browser and nothing is uploaded.
Use the HEX to RGBA converter, which has an opacity slider.