Add transparency to any HEX color. Type a HEX code, set the opacity and copy a ready-to-use rgba() value or CSS rule. 4 and 8-digit HEX codes keep their own alpha.
3, 4, 6 or 8 digits, with or without #.
Checkerboard
On white
On dark
RGBA
Modern CSS
HEX 8-digit
RGB
CSS rule
Convert a list of HEX codes
Advertisement
Advertisement
How to use the HEX to RGBA Converter
Enter a HEX code such as #2F6B4F, 2f6b4f or #fff, or pick a color with the color button.
Set the opacity with the slider, the number box or a quick preset like 50%.
Check the preview on a checkerboard, white and dark background.
Copy the rgba() value, the modern CSS syntax, the 8-digit HEX or a complete CSS rule.
Have many colors? Open “Convert a list of HEX codes” and paste them all.
HEX to RGBA formula
A HEX color is three (or four) bytes written in base 16. To convert it:
Remove the # and expand short forms by doubling each digit: #3A7 → #33AA77, #3A78 → #33AA7788.
Convert each pair to decimal: first digit × 16 + second digit, where A = 10 … F = 15. 6B = 6 × 16 + 11 = 107.
If there is a fourth pair, alpha = that value ÷ 255. Otherwise use the opacity you choose (0 to 1).
Write rgba(R, G, B, alpha).
Opacity percent to HEX alpha
Use this table to write transparency directly in an 8-digit HEX code (#RRGGBB + alpha pair). The alpha pair is round(percent × 255 ÷ 100) in hexadecimal.
Opacity
rgba() alpha
HEX alpha
Decimal (0–255)
100%
1
FF
255
95%
0.95
F2
242
90%
0.9
E6
230
85%
0.85
D9
217
80%
0.8
CC
204
75%
0.75
BF
191
70%
0.7
B3
179
65%
0.65
A6
166
60%
0.6
99
153
55%
0.55
8C
140
50%
0.5
80
128
45%
0.45
73
115
40%
0.4
66
102
35%
0.35
59
89
30%
0.3
4D
77
25%
0.25
40
64
20%
0.2
33
51
15%
0.15
26
38
10%
0.1
1A
26
5%
0.05
0D
13
0%
0
00
0
When to use rgba() colors
Overlays on photos: a dark rgba(0, 0, 0, 0.5) layer makes white text readable on any image.
Shadows and borders: semi-transparent colors blend with any background. Try the CSS Box Shadow Generator.
Hover and selected states: a 10–15% tint of your brand color works on both light and colored backgrounds.
Need a solid HEX for a tool that does not support transparency? Flatten it with RGBA to HEX.
Frequently asked questions
How do I convert HEX to RGBA?
Split the HEX code into three pairs and convert each from base 16 to decimal: #2F6B4F becomes 2F = 47, 6B = 107, 4F = 79. Add the opacity as a number from 0 to 1 to get rgba(47, 107, 79, 0.5). A 3-digit code like #FFF is expanded first by doubling each digit (#FFFFFF).
What does an 8-digit HEX code mean?
The last two digits are the alpha (opacity) channel, from 00 (fully transparent) to FF (fully opaque). For example #2F6B4F80 has alpha 0x80 = 128, and 128 ÷ 255 ≈ 0.502, so it equals rgba(47, 107, 79, 0.502).
Can I use 8-digit HEX in CSS instead of rgba()?
Yes. #RRGGBBAA and the short #RGBA form are part of CSS Color Level 4 and work in all current browsers. rgba() is still useful for older tools, email templates and when you want to read the opacity at a glance.
What is the difference between rgba() and rgb() with a slash?
They are equivalent. Modern CSS lets you write rgb(47 107 79 / 50%) with spaces and an alpha after a slash; the older rgba(47, 107, 79, 0.5) uses commas. Both are supported by all modern browsers.
What opacity values are common?
Designers often use 10–20% for subtle backgrounds and hover states, 50% for overlays and 70–90% for text on images. Check that text stays readable with a contrast checker.
Is opacity the same as the CSS opacity property?
No. rgba() makes only that color transparent, for example a background, while the opacity property fades the whole element including its text and children.