Convert rgba() colors to HEX. Get the 8-digit #RRGGBBAA code that keeps transparency, or flatten the color on a background to get the solid HEX you actually see, for tools that do not support alpha.
Accepts rgba(), rgb(R G B / A), percentages and plain numbers.
With transparency
Flattened
HEX 8-digit
Flattened HEX
HEX no alpha
Short HEX
Android ARGB
RGBA
Advertisement
Advertisement
How to use the RGBA to HEX Converter
Paste an rgba() value such as rgba(47, 107, 79, 0.5), or set red, green, blue and alpha with the sliders.
Copy the 8-digit HEX if your app or CSS supports transparency in HEX.
Need a solid color? Keep “Flatten on a background” on and choose the background the color sits on.
Copy the flattened HEX: it matches what you see on that background, with no transparency.
Building an Android app? Use the ARGB value, which puts the alpha first.
RGBA to HEX formulas
8-digit HEX (keeps transparency): write each of R, G and B (0–255) as two hexadecimal digits, then add the alpha as round(alpha × 255) in hex. The result is #RRGGBBAA.
Flattened HEX (solid color): blend each channel with the background, then convert to HEX:
R = Rcolor × alpha + Rbackground × (1 − alpha)
G = Gcolor × alpha + Gbackground × (1 − alpha)
B = Bcolor × alpha + Bbackground × (1 − alpha)
This is the standard “source-over” alpha blend browsers use to draw a transparent color over an opaque background (in sRGB without gamma correction).
Examples
RGBA
8-digit HEX
Flattened on white
Flattened on black
rgba(0, 0, 0, 0.5)
#00000080
#808080
#000000
rgba(0, 0, 0, 0.1)
#0000001A
#E6E6E6
#000000
rgba(255, 255, 255, 0.5)
#FFFFFF80
#FFFFFF
#808080
rgba(255, 0, 0, 0.5)
#FF000080
#FF8080
#800000
rgba(0, 0, 255, 0.25)
#0000FF40
#BFBFFF
#000040
rgba(47, 107, 79, 0.75)
#2F6B4FBF
#63907B
#23503B
Which HEX should I use?
CSS for modern browsers: the 8-digit HEX or the original rgba() both work and stay transparent.
Email templates, PDFs, print and older apps: use the flattened HEX, because many of them ignore or mishandle alpha.
Design hand-off: give both. Designers often specify “black at 60%” while developers need the exact solid color for a given background.
Going the other way? Use HEX to RGBA. Blending two solid colors instead? Try the Color Mixer.
Frequently asked questions
How do I convert RGBA to HEX?
Convert red, green and blue (0–255) to two hexadecimal digits each, then convert the alpha by multiplying it by 255, rounding, and writing it as two more hex digits. rgba(47, 107, 79, 0.5) becomes 2F, 6B, 4F and 0.5 × 255 = 127.5 → 128 = 80, so #2F6B4F80.
What does flattening a transparent color mean?
It mixes the color with the background it sits on, so you get one solid color: result = color × alpha + background × (1 − alpha) for each channel. rgba(0, 0, 0, 0.5) on white becomes #808080. This is useful for email, print, PDFs and tools that ignore alpha.
Why is the 8-digit HEX alpha slightly different from my value?
HEX alpha has only 256 steps (00 to FF). An alpha of 0.5 becomes 80 (128), which reads back as 0.502. The difference is less than 0.2% and invisible.
What is the ARGB format?
Android and some other platforms write colors as #AARRGGBB, with alpha first. The same color as #2F6B4F80 in CSS is #802F6B4F in Android XML.
Do all browsers support 8-digit HEX?
Yes, all current versions of Chrome, Edge, Firefox and Safari support #RRGGBBAA and #RGBA in CSS. Some older software, email clients and design tools do not; use the flattened HEX or rgba() there.
Can I enter RGB values as percentages?
Yes. rgb(100% 50% 0%) is converted with 100% = 255. Alpha can be written as 0–1 or as a percentage, like rgb(255 128 0 / 50%).