๐Ÿ’งHEX Color Opacity Converter

Opacity to 8-digit HEX and rgba(), with the rounding gap shown

%

You Might Also Need

Moving an opacity into two hexadecimal digits

An 8-digit HEX, with two alpha digits appended to the color, is compact enough that it travels easily between design files and code. The friction is that people talk in percentages while files store an integer from 0 to 255. This converter takes a color and an opacity and returns both the 8-digit HEX and the rgba() form, and in the other direction it tells you what percentage an alpha pair actually represents.

The conversion multiplies your percentage by 255 and rounds to the nearest integer. That integer is then divided by 255 and shown back as a percentage, so the gap between what you asked for and what actually applies is visible rather than hidden. The 8-digit notation is defined in the W3C CSS Color specification and is supported by major browsers as of October 2026. The table below walks the whole range in 5 percent steps.

Watch the digit order. CSS puts the color first, as RRGGBBAA, while Android color constants put alpha first, as AARRGGBB. Because of the rounding, a value such as exactly 50 percent cannot be represented. Blending two colors into a midpoint and generating palettes are not covered here.

Frequently asked questions

Why does 50 percent come out as 80?

Alpha is stored as an integer from 0 to 255, so 50 percent is 127.5 and rounds to 128, which is 80 in hexadecimal. Converting 128 back gives 50.196 percent, so exactly 50 percent is not representable.

Will an 8-digit HEX work on Android as well?

The digit order differs. CSS puts alpha last, as RRGGBBAA, while Android color constants put alpha first, as AARRGGBB. Pasting the same string across the two swaps the channels around.

Should I use rgba() or 8-digit HEX?

They describe the same color. The 8-digit form is shorter but very old browsers do not understand it, so rgba() is the safer choice when you need wide support.