Hex to RGBA Converter
Convert hex colors to rgba() format with alpha transparency — accepts 8-digit hex-with-alpha input like 2563EB80 for CSS Color 4 notation.
How Hex to RGBA Conversion Works
RGBA needs a 4th channel beyond red, green, and blue: alpha, which controls opacity. Plain 6-digit hex only encodes RGB, so this tool accepts the CSS Color 4 8-digit hex-with-alpha notation (RRGGBBAA) — an extra byte pair appended to a normal hex code that represents transparency. If you enter a plain 6-digit hex, alpha defaults to 1 (fully opaque).
Hex to RGBA Example, Step by Step
#2563EB80 = rgba(37, 99, 235, 0.502)
#2563EB80 (hex-with-alpha) = rgba(37, 99, 235, 0.502)
Split into pairs: 25 | 63 | EB | 80 25 (hex) = 37 (decimal) -> Red 63 (hex) = 99 (decimal) -> Green EB (hex) = 235 (decimal) -> Blue 80 (hex) = 128 (decimal) -> Alpha byte 128 / 255 = 0.502 -> Alpha
| Step | Description | Result |
|---|---|---|
| Split the hex code | #2563EB80 -> 25, 63, EB, 80 | 4 byte pairs |
| Convert RGB channels | 25, 63, EB (hex) = 37, 99, 235 (decimal) | R = 37, G = 99, B = 235 |
| Convert the alpha byte | 80 (hex) = 128 (decimal) | 128 / 255 |
| Scale alpha to 0-1 | 128 / 255 = 0.502 | alpha = 0.502 |
A plain 6-digit hex has no alpha byte, so this tool treats it as fully opaque — 2563EB converts to rgba(37, 99, 235, 1), not an error.
Common Mistakes With Hex to RGBA
- Assuming a plain 6-digit hex code carries transparency information — it doesn't, alpha must come from an 8th and 7th digit pair.
- Reading the alpha byte as a direct percentage instead of dividing by 255 to get the 0-1 range CSS uses.
- Confusing 8-digit hex-with-alpha (RRGGBBAA) with 4-digit shorthand (RGBA), which needs each digit doubled first.
Frequently Asked Questions
How is hex to RGBA different from hex to RGB?
RGBA adds a 4th channel — alpha (opacity) — on top of red, green, and blue. Plain 6-digit hex has no way to express transparency, so this tool reads an 8-digit hex-with-alpha value instead.
What does the extra 2 digits in an 8-digit hex code mean?
In RRGGBBAA notation, the last byte pair is the alpha channel, from 00 (fully transparent) to FF (fully opaque) — the CSS Color 4 standard for encoding opacity directly in hex.
What if I only enter a 6-digit hex code?
Alpha defaults to 1 (fully opaque) — 2563EB converts to rgba(37, 99, 235, 1), the same color as rgb(37, 99, 235) but in rgba() syntax.
Why is the alpha value shown as a decimal like 0.502 instead of a round number?
Alpha is stored as a single byte (0-255) in the hex, then divided by 255 to get the 0-1 range CSS expects. 80 (hex) = 128 (decimal), and 128 / 255 = 0.502.
Can I use this for CSS box-shadow or background colors with transparency?
Yes — the rgba() output pastes directly into any CSS property that accepts a color value, including background-color, box-shadow, and border-color.