RGBA to HEX Converter
Convert RGBA colors to 8-digit HEX and back — control transparency with the alpha channel and copy production-ready codes.
Design tools and CSS speak RGBA, but many codebases and design tokens want 8-digit HEX (#rrggbbaa). Enter either format and get the other instantly: the alpha channel maps 0–1 onto the final hex pair (00–ff), and the converter also handles 3, 4, and 6-digit HEX input.
→ rgba(255, 0, 0, 0.502)
How to use this calculator
- Enter an RGBA color with the channel inputs, or paste a HEX code of 3, 4, 6, or 8 digits.
- Watch the conversion update live in both directions.
- Copy the 8-digit HEX for your design tokens or code.
- Remember the alpha mapping: 0 = 00 (transparent), 0.5 ≈ 80, 1 = ff (opaque).
Worked example
Half-transparent red, rgba(255, 0, 0, 0.5), converts to #ff000080 — the trailing 80 hex pair encodes the 50% alpha (128 of 255). Pasting #ff000080 back returns rgba(255, 0, 0, 0.502).
Frequently Asked Questions
What is 8-digit HEX?
Standard 6-digit HEX (#rrggbb) plus a seventh and eighth digit for the alpha (transparency) channel: #ff000080 is red at 50% opacity. It is supported in all modern browsers, Android, and most design tools. The alpha pair runs 00 (fully transparent) to ff (fully opaque), mapping linearly from the 0–1 alpha you know from rgba().
How does the alpha value convert to hex?
Multiply the 0–1 alpha by 255 and round: 0.5 × 255 = 127.5, which rounds to 128, or 80 in hex. So rgba(255, 0, 0, 0.5) becomes #ff000080. Converting back, 0x80 = 128 and 128 ÷ 255 ≈ 0.502, shown rounded to three decimals.
When should I use 8-digit HEX instead of rgba()?
Use 8-digit HEX in design tokens, JSON configs, and anywhere a single compact string is easier to store or compare than rgba() functional notation. Use rgba() in CSS when readability matters — rgba(255, 0, 0, 0.5) is clearer to a human than #ff000080. Both render identically in modern browsers.
Does 8-digit HEX work in all browsers?
All modern browsers (Chrome, Edge, Firefox, Safari) have supported #rrggbbaa since around 2020. Very old browsers ignore the declaration, so for legacy support declare the 6-digit color first and the 8-digit one after — browsers that understand it will use the later rule.