HEX alpha converter

Type a color with transparency in any common form: 8-digit HEX, 4-digit HEX, rgba(), hsla() or the space-separated rgb(51 102 204 / 50%). The converter shows the 8-digit HEX, rgba() and hsla() versions, and the alpha channel as a percent and a byte value.

HEX with 3, 4, 6 or 8 digits, rgb()/rgba() or hsl()/hsla(). No alpha means fully opaque.
HEX with alpha (#RRGGBBAA)#3366cc80
rgba()rgba(51, 102, 204, 0.502)
Short HEX with alpha (#RGBA)
Not possible (a digit pair is not doubled)
hsla()
hsla(220, 60%, 50%, 0.502)
Alpha as a percent
50.2%
Alpha as a byte
128 / 255 = 0x80

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Type or paste a color. HEX can have 3, 4, 6 or 8 digits, with or without the leading #.
  2. Read the 8-digit HEX, the rgba() and hsla() forms, and the alpha as a percent and as a byte.
  3. Press Copy next to the format you need.

How it works

Each HEX pair is a byte from 0 to 255. The alpha byte divided by 255 gives the CSS alpha from 0 to 1; the other direction multiplies by 255 and rounds to the nearest whole number. Short forms double each digit: #f008 → #ff000088. For rgb() and hsl() an alpha written as a percent (50%) or a number (0.5) is accepted, after a comma or a slash.

Example

#3366cc80 has red 0x33 = 51, green 0x66 = 102, blue 0xcc = 204 and alpha 0x80 = 128, which is rgba(51, 102, 204, 0.502), about 50.2 percent opaque. The same color in HSL is hsla(220, 60%, 50%, 0.502).

Tips

  • The alpha byte has only 256 steps, so some percentages, such as 50, cannot be written exactly in HEX.
  • Alpha only changes opacity, not the color: the same pair of values over a different background looks different.
  • Check text contrast against the real background, not the transparent color alone.

Frequently asked questions

What do the last two digits of #RRGGBBAA mean?

They are the alpha channel, the opacity, from 00 (fully transparent) to ff (fully opaque). The first six digits are the usual red, green and blue pairs.

How is alpha 0.5 turned into HEX?

The alpha is multiplied by 255 and rounded: 0.5 × 255 = 127.5, which rounds to 128, written 80 in hexadecimal. Going back, 0x80 = 128 and 128 ÷ 255 = 0.502, so a round trip can show 0.502 instead of 0.5.

Can every color use the short #RGBA form?

No. In #RGBA each digit stands for a doubled pair, so #f008 means #ff000088. A color such as #3366cc80 has the pair 80, which is not doubled, so it needs the long form.

Do browsers support 8-digit HEX?

Yes, #RRGGBBAA and #RGBA are part of CSS Color Level 4 and work in current Chrome, Edge, Firefox and Safari. For very old browsers use rgba() instead.

More in Color

All tools in this category: Color ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.