Skip to content
Hex Calculator

RGBA to Hex Converter

Convert rgba() color values with an alpha channel into an 8-digit hex code — the compact RRGGBBAA format CSS Color 4 and design tools use.

Hex result
#2563EB80

How RGBA to Hex Conversion Works

The red, green, and blue channels (0-255 each) convert to hex pairs exactly like a normal RGB-to-hex conversion. The alpha channel (0-1) converts separately: multiply by 255, round to the nearest whole number, then convert that to a 4th hex pair. All four pairs concatenate into an 8-digit RRGGBBAA hex code.

RGBA to Hex Example, Step by Step

rgba(37, 99, 235, 0.5) = #2563EB80

rgba(37, 99, 235, 0.5) = #2563EB80

37 (decimal) = 25 (hex) -> Red
99 (decimal) = 63 (hex) -> Green
235 (decimal) = EB (hex) -> Blue

0.5 x 255 = 127.5, rounded = 128
128 (decimal) = 80 (hex) -> Alpha

Concatenate: 25 + 63 + EB + 80 = 2563EB80
StepDescriptionResult
Convert RGB channels37, 99, 235 (decimal) = 25, 63, EB (hex)2563EB
Scale alpha to a byte0.5 x 255 = 127.5, rounded to 128128
Convert alpha to hex128 (decimal) = 80 (hex)80
Combine with # prefixjoin all four pairs#2563EB80

Alpha rounds to the nearest whole byte before converting, so very close alpha values (like 0.501 and 0.502) can produce the same hex output.

Common Mistakes With RGBA to Hex

  • Forgetting to scale alpha from the 0-1 range to a 0-255 byte before converting it to hex.
  • Entering an alpha value above 1, such as 50 instead of 0.5.
  • Assuming the output is a normal 6-digit hex code when it's actually 8 digits with an alpha byte appended.

Frequently Asked Questions

How do you convert RGBA to hex?

Convert red, green, and blue to 2-digit hex pairs like a normal RGB-to-hex conversion, then convert the alpha value (0-1) to a 4th hex pair by multiplying by 255 and rounding.

What format does this tool accept for RGBA input?

Either plain comma-separated numbers (37, 99, 235, 0.5) or a full rgba() function string (rgba(37, 99, 235, 0.5)) — both work the same.

Why does the hex output have 8 digits instead of 6?

The extra 2 digits (the 4th byte pair) encode the alpha channel. This is the CSS Color 4 hex-with-alpha notation — RRGGBBAA — not a different color format.

What if alpha is 1 (fully opaque)?

It still appends FF as the last byte pair — rgba(255, 0, 0, 1) becomes #FF0000FF, not #FF0000, since this tool always outputs the full 8-digit form.

Will every browser and design tool accept an 8-digit hex code?

All modern browsers support it, but some older design tools and image formats only read 6-digit hex — check your target platform if you need broad compatibility.