HEX to RGBA Converter
Convert HEX to RGBA with any opacity. Paste a hex color code, set the alpha with the slider and copy the rgba() value. 8-digit hex codes are supported.
Enter a 6-digit hex code and set the opacity below, or paste an 8-digit code (#RRGGBBAA) that already includes transparency.
| HEX | | |
|---|---|---|
| HEX + alpha | | |
| RGB | | |
| RGBA | | |
| HSL | | |
| OKLCH | | |
| Tailwind | |
Convert Hex Colors to RGBA with Transparency
Hex codes describe a solid color. When you need a transparent version of a brand color for an overlay, a hover state, a shadow or a tinted background, you need RGBA. This converter turns any hex code into rgba() with the opacity you choose.
Drag the opacity slider and watch the preview update over a checkerboard, so you can see exactly how transparent the color is. You also get the matching 8-digit hex code, HSL and OKLCH values and a Tailwind class.
How to convert HEX to RGBA
- Enter the hex code, for example
#4F46E5, or pick a color. - Set the opacity with the slider: 1 is fully opaque, 0 is fully transparent and 0.5 is half transparent.
- Copy the RGBA value, such as
rgba(79, 70, 229, 0.5), or the 8-digit hex code from the table.
What is RGBA?
RGBA is RGB plus an alpha channel that controls opacity. The first three numbers are red, green and blue from 0 to 255. The fourth is the alpha from 0 (invisible) to 1 (solid). In rgba(79, 70, 229, 0.5) the color is indigo at 50% opacity, so whatever is behind it shows through.
The same color can be written as an 8-digit hex code, where the last two digits are the alpha: #4F46E580. Modern CSS also accepts rgb(79 70 229 / 50%).
Opacity percentage to alpha and hex
Use this table to go from an opacity percentage to the rgba() alpha value or the two-digit hex suffix:
| Opacity | Alpha (rgba) | Hex suffix | Example |
|---|---|---|---|
| 100% | 1 | FF | #4F46E5FF |
| 90% | 0.9 | E6 | #4F46E5E6 |
| 80% | 0.8 | CC | #4F46E5CC |
| 75% | 0.75 | BF | #4F46E5BF |
| 70% | 0.7 | B3 | #4F46E5B3 |
| 60% | 0.6 | 99 | #4F46E599 |
| 50% | 0.5 | 80 | #4F46E580 |
| 40% | 0.4 | 66 | #4F46E566 |
| 30% | 0.3 | 4D | #4F46E54D |
| 25% | 0.25 | 40 | #4F46E540 |
| 20% | 0.2 | 33 | #4F46E533 |
| 10% | 0.1 | 1A | #4F46E51A |
| 0% | 0 | 00 | #4F46E500 |
RGBA vs the CSS opacity property
An RGBA color only makes that one color transparent. The CSS opacity property makes the whole element transparent, including its text, borders, images and children. For a see-through background behind solid text, use an RGBA background color instead of opacity:
background-color: rgba(79, 70, 229, 0.15); color: #312E81;
Transparent colors in Tailwind CSS
- Palette colors: add an opacity modifier, for example
bg-indigo-600/50for 50%. - Custom colors: use the 8-digit hex from the table,
bg-[#4f46e580], orbg-[rgba(79,70,229,0.5)]. - Shadows and overlays: the same values work in arbitrary shadows, see the box shadow generator.
Frequently Asked Questions
Common questions about converting hex colors to RGBA.
Convert the hex code to RGB (#4F46E5 = 79, 70, 229) and add the opacity as a fourth value between 0 and 1: rgba(79, 70, 229, 0.5). Use the slider above to choose the opacity.
A stands for alpha, the opacity of the color. 1 is fully opaque, 0 is fully transparent.
Add 80 to the end of a 6-digit hex code: #4F46E5 at 50% is #4F46E580. The opacity table above lists the hex suffix for other percentages.
Yes. Paste it into the field and the last two digits are used as the alpha, so #4F46E580 becomes rgba(79, 70, 229, 0.502).
Hex alpha is stored as a whole number out of 255. 80 in hex is 128, and 128 ÷ 255 = 0.502. Browsers render it the same as 0.5.
Yes. rgba() has worked in every browser for over a decade, and 8-digit hex codes work in all current browsers.
Use the RGBA to HEX converter. It gives you the 8-digit code and a solid 6-digit color as it looks on white or black.