Skip to main content
CalcChef

Hex to RGBA Converter

Convert hex to rgba(): #007BFF is rgba(0, 123, 255, 1). Reads 3, 4, 6 and 8-digit hex or rgb()/rgba(), sets the opacity, and gives hsla() and 8-digit hex. How it works

Use the Hex to RGBA Converter

Alpha comes from the opacity control (1). In hex that is FF (100.0%).

RGBA
rgba(0, 123, 255, 1)
Preview
RGBArgba(0, 123, 255, 1)
HSLAhsla(211, 100%, 50%, 1)
Hex#007BFF
8-digit Hex#007BFFFF
CSS Variable--color: #007BFFFF;
R: 0
G: 123
B: 255
A: 1

About the Hex to RGBA Converter

#007BFF is rgba(0, 123, 255, 1); at 50% opacity it is rgba(0, 123, 255, 0.5), or #007BFF80 in 8-digit hex. Each pair of hex digits is one channel from 0 to 255 (00 to FF), and in 8-digit hex the last pair is the alpha: 80 is 128, and 128 ÷ 255 = 0.502. This hex to RGBA converter also reads #RGB, #RGBA, #RRGGBBAA and rgb() or rgba() text.

What the converter gives for each kind of input

You typeRGBAHSLA8-digit hexAlpha taken from
#007bffrgba(0, 123, 255, 1)hsla(211, 100%, 50%, 1)#007BFFFFthe opacity control (1)
#f00rgba(255, 0, 0, 1)hsla(0, 100%, 50%, 1)#FF0000FFthe opacity control (1)
#f008rgba(255, 0, 0, 0.533)hsla(0, 100%, 50%, 0.533)#FF000088the color text
FF5733rgba(255, 87, 51, 1)hsla(11, 100%, 60%, 1)#FF5733FFthe opacity control (1)
#FF573380rgba(255, 87, 51, 0.502)hsla(11, 100%, 60%, 0.502)#FF573380the color text
rgba(255, 87, 51, 0.5)rgba(255, 87, 51, 0.5)hsla(11, 100%, 60%, 0.5)#FF573380the color text
rgb(255 87 51 / 50%)rgba(255, 87, 51, 0.5)hsla(11, 100%, 60%, 0.5)#FF573380the color text
#ff8800ccrgba(255, 136, 0, 0.8)hsla(32, 100%, 50%, 0.8)#FF8800CCthe color text
#00000000rgba(0, 0, 0, 0)hsla(0, 0%, 0%, 0)#00000000the color text

Opacity control left at 1. When the color text carries its own alpha (4 or 8 hex digits, or rgba() with an alpha), that alpha is used and the opacity control is ignored.

Opacity and the hex alpha pair

OpacityHex alphaByte (0 to 255)Read back from the hex
00000
0.11A260.102
0.233510.2
0.2540640.251
0.5801280.502
0.75BF1910.749
0.8CC2040.8
0.9E62300.902
1FF2551

The hex alpha is a whole byte, so most opacities do not survive the round trip exactly: 0.5 becomes 80 (128) and reads back as 0.502. An alpha that rounds to byte 00 or FF is written as exactly 0 or 1, so rgba(1, 2, 3, 0.999) comes out as alpha 1 and #010203FF.

Frequently asked questions

How do I convert hex to RGBA?
Split the code into pairs and turn each pair into a number from 0 to 255: in #007BFF, 00 is 0, 7B is 7 × 16 + 11 = 123 and FF is 255, so the color is rgba(0, 123, 255, 1) when fully opaque. Then put the opacity, from 0 to 1, in the fourth place.
What is an 8-digit hex color?
CSS Color Level 4 allows #RRGGBBAA, where the last pair is the alpha: 00 is fully transparent and FF fully opaque. #FF8800CC is rgba(255, 136, 0, 0.8). The 4-digit form doubles each digit, so #f008 is #FF000088, an alpha of 0.533.
Why does 50% opacity become 80 in hex?
The alpha pair is a byte: 0.5 × 255 = 127.5, which rounds to 128, and 128 is 80 in hex. Reading it back gives 128 ÷ 255 = 0.502, so the converter shows rgba(255, 87, 51, 0.502) for #FF573380.
Can I convert RGBA back to hex?
Yes. Paste rgba(255, 87, 51, 0.5) or the newer rgb(255 87 51 / 50%) and the hex output is #FF573380. Red, green and blue must be whole numbers from 0 to 255; percentages such as rgb(100% 0% 0%) get a message.
Is rgba() still valid CSS?
Yes. CSS Color Level 4 makes rgba() an alias of rgb(), and both accept an alpha. The newer form separates the values with spaces and puts the alpha after a slash, as in rgb(0 123 255 / 0.5).

Related Tools

View all tools