RGBA to HEX

Turn any rgba() value with transparency into an 8-digit HEX color.

HEX
#4F46E580

About the rgba to hex

8-digit HEX is a compact way of encoding an RGBA color. The first six digits are the usual RGB pairs and the last two encode alpha from 00 (fully transparent) to FF (fully opaque).

rgba(79, 70, 229, 0.5) becomes #4F46E580.

Frequently asked questions

Is 8-digit HEX with alpha supported in CSS?+

Yes. All modern browsers support 8-digit HEX values where the last two digits represent alpha.

How is the alpha channel converted to HEX?+

Multiply the 0–1 alpha by 255 and convert to two hexadecimal digits. 0.5 alpha becomes 80 in HEX.

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

Use whichever is easier in your codebase. 8-digit HEX is more compact; rgba() is easier to read.