RGBA to Hex Converter

Convert rgba() colors with transparency to 8-digit hex codes (#RRGGBBAA), and back. Also outputs Android ARGB and HSLA formats. All conversions happen in your browser.

Current Color

#FF573380

50%

Color Values

Hex (8-digit)#FF573380
Hex (no alpha)#FF5733
RGBArgba(255, 87, 51, 0.5)
ARGB (Android)#80FF5733
HSLAhsla(11, 100%, 60%, 0.5)

RGBA to Hex Formula

An RGBA color becomes an 8-digit hex code by converting each channel to hexadecimal, including the alpha channel scaled to 0-255:

  1. Convert R, G, and B (0-255) to two-digit hex pairs, exactly like a normal hex code.
  2. Multiply the alpha value (0-1) by 255 and round to a whole number.
  3. Convert the alpha number to a two-digit hex pair.
  4. Concatenate as #RRGGBBAA. For Android ARGB, place the alpha pair first: #AARRGGBB.

Example: convert rgba(255, 87, 51, 0.5) to hex

R = 255 → FF, G = 87 → 57, B = 51 → 33

A = 0.5 × 255 = 128 → 80

CSS 8-digit hex: #FF573380

Android ARGB: #80FF5733

How to Use the RGBA to Hex Converter

Paste an rgba() value like rgba(255, 87, 51, 0.5), an 8-digit hex code, or a plain hex color, then fine-tune transparency with the alpha slider. The tool outputs the CSS 8-digit hex, the hex without alpha, the rgba() string, the Android ARGB code, and the HSLA equivalent - each with a copy button. The checkered preview shows the real transparency.

Understanding Hex Alpha Notation

Standard 6-digit hex codes have no way to express transparency, which is why rgba() existed long before hex alpha. CSS Color Level 4 added 8-digit hex, where the final two digits encode opacity from 00 to FF. Because the scale is 0-255 rather than 0-100, common opacities map to non-obvious pairs: 80% is CC, 50% is 80, 25% is 40, and 10% is 1A.

Common Use Cases

Converting overlay and shadow colors from design tools that export rgba() into compact hex tokens, translating web colors into Android ARGB resources, building design token files that standardize on 8-digit hex, and debugging why a pasted #AARRGGBB value renders wrong in CSS.

Frequently Asked Questions about RGBA to Hex Converter

An 8-digit hex code appends two extra digits for alpha: #RRGGBBAA. The alpha pair ranges from 00 (fully transparent) to FF (fully opaque). For example, 50% opacity is 80, so rgba(255, 87, 51, 0.5) becomes #FF573380.