Format Code Now
/
Web & markupHex to RGBA Converter Next: Color Converter ›

Hex to RGBA Converter

WM-11

Paste hex colors and get rgba() back. An 8-digit hex keeps its own alpha, and for 6-digit codes you pick the alpha from a menu.

Runs in your browser. Nothing is uploaded.

Hex colors, one per line

RGBA

How to use it

  1. Paste one hex color per line, 6 or 8 digits (3 and 4 digits work too).
  2. Choose the alpha to give colors that have none, from 1 down to 0.
  3. Read the rgba() values in the result box.
  4. Copy the result or download it.

Where the alpha comes from

If the code has its own alpha, as in #3366cc80 or #36c8, the page keeps it. The last pair is a byte, so it is divided by 255 and shown to three decimals: 80 gives 0.502 and 40 gives 0.251. It is not rounded to a neat 0.5, because that would be a slightly different color. For a code without alpha, such as #3366cc, the menu supplies it: 1, 0.9, 0.75, 0.5, 0.25, 0.1 or 0. The menu never overrides an alpha that the input already has.

Output form

The result is always rgba(r, g, b, a), with whole-number channels, even when alpha is 1. That makes it easy to paste into CSS and to change the last number later. Other color formats, such as rgb() with a slash alpha or hsla(), are read too, and a color name like tomato gets the menu alpha.

What it does not do

It does not blend the color with a background, so the result describes the color and opacity, not the final pixel. For a check of text on a background, use the contrast checker. The conversion runs in your browser and nothing is uploaded.

Error messages and what to do

MessageWhat it meansFix
Line 1: rgb() has a "/" with no alpha after itA slash was written but nothing follows it.Add the alpha after the slash, or remove it.
Line 1: "nope" is not a color. Use hex (#rgb, #rrggbb, #rrggbbaa), rgb(), hsl(), hsv(), cmyk() or a CSS color name.The line is not a format the page reads.Check the spelling or use #rrggbb.

Questions people ask

How do I convert hex to rgba?

Convert the six digits to red, green and blue as usual and add an alpha. For #ff8800 at half opacity that is rgba(255, 136, 0, 0.5). Pick 0.5 from the Alpha menu above, or use an 8-digit code to carry the alpha itself.

How do I convert an 8-digit hex to rgba?

The last two digits are alpha as a byte. Divide by 255. #ff880080 has 80, which is 128, so alpha is 128 / 255, about 0.502. The page shows rgba(255, 136, 0, 0.502).

Is 8-digit hex supported in browsers?

Current browsers read #rrggbbaa in CSS. Very old browsers do not, which is why people convert to rgba() instead. The rgba() output from this page works everywhere CSS color functions work.

What hex value is 50 percent opacity?

Half of 255 is 127.5, which rounds to 128, hex 80. So #00000080 is black at about 50 percent. The page shows the alpha as 0.502, not exactly 0.5, because it is 128 divided by 255.

Why does the alpha menu not change my 8-digit codes?

Because those codes already say what the alpha is, and the menu never overrides that. The menu only fills in the alpha for colors that have none. To change the alpha of an 8-digit code, edit its last two digits.

About this tool

The output is always written as rgba(r, g, b, a). A color that has its own alpha (8-digit or 4-digit hex, or rgba/hsla input) keeps it: the hex byte is divided by 255 and shown to three decimals, so 80 becomes 0.502 and 40 becomes 0.251. The alpha menu only applies to colors that have none, such as a 6-digit hex. Alpha is not rounded to a tidy value like 0.5, because that would change the color. The result is a color value only: it is not blended against any background. Any other color format works as input too: hex, rgb(), hsl(), hsv(), cmyk() or a CSS color name.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.