UTILS.
Private by default
#α

HEX ⇄ RGBA

Convert between HEX color codes with alpha and rgba() notation, with a live preview.

Your files stay on this device

Files are processed in your browser, never uploaded. The site downloads code and assets to run the tools. No accounts or trackers.

Use Download to save this tool as one HTML file for offline use.

Privacy →

About this tool

Convert between HEX (including #RGB, #RRGGBB and #RRGGBBAA) and rgba() with an adjustable alpha and a checkerboard preview, all in your browser.

Type in either field and the other updates, along with the alpha slider and the preview. The tool reads 3, 4, 6 or 8 digit hex codes, with or without the #. A 3 or 4 digit code is expanded by doubling each digit, and 3 and 6 digit codes are fully opaque. Hex produced from the rgba field or the slider is always the 8 digit form, with the alpha pair last.

On the rgba side, rgb() and rgba() are both read, separated by commas or spaces. Red, green and blue must be 0 to 255, and alpha 0 to 1 or a percentage. Text that cannot be read shows an invalid message and leaves the other field unchanged.

Frequently asked questions

Which hex formats are supported?
Shorthand #RGB and #RGBA plus full #RRGGBB and #RRGGBBAA are all parsed.
How is transparency shown?
The preview swatch sits over a checkerboard so the alpha channel is visible at a glance.
Why does the generated hex code have eight digits?
The last two digits are the alpha channel, so a fully opaque color ends in ff. Drop those two digits if you want the six digit form.

More tools