RGBA to Hex Converter

This RGBA to Hex converter transforms RGBA color values (red, green, blue, alpha) into hexadecimal color codes. Enter RGBA values from 0-255 for each color channel and 0-1 for alpha transparency to get the equivalent 6 or 8 digit hex code with live color preview.

RGBA to Hex Converter

Convert RGBA values into 6-digit or 8-digit hexadecimal color codes with live preview and reverse conversion.

rgba(255, 255, 255, 1)
#FFFFFF
#FFFFFFFF

Hex to RGBA

Paste a 3, 4, 6, or 8 digit hex code to convert it back into RGBA values.

Frequently Asked Questions

What is RGBA color format?

RGBA stands for Red, Green, Blue, Alpha. Each color channel (R, G, B) takes a value from 0-255, while the Alpha channel controls opacity from 0 (fully transparent) to 1 (fully opaque). For example, rgba(255, 0, 0, 0.5) is a semi-transparent red.

How do you convert RGBA to hex?

Convert each R, G, B value from decimal to hexadecimal: divide by 16, the quotient is the first hex digit, the remainder is the second. For the alpha channel, multiply by 255, then convert to hex. For example, rgba(255, 128, 0, 0.5): R=FF, G=80, B=00, A=80 → #FF800080.

What is 8-digit hex color?

Standard hex colors use 6 digits (#RRGGBB) for red, green, and blue channels. 8-digit hex (#RRGGBBAA) adds two digits for the alpha channel, supporting transparency without using the rgba() function. For example, #FF000080 is red at 50% opacity.

What is rgba(255,0,0,0.5) in hex?

rgba(255,0,0,0.5) converts to #FF000080 in 8-digit hex format. The red channel (255) becomes FF, green (0) becomes 00, blue (0) becomes 00, and alpha (0.5) becomes 80 (which is 128 in decimal, or 50% of 255).

Do all browsers support 8-digit hex colors?

Yes, all modern browsers support 8-digit hex colors (#RRGGBBAA) as part of CSS Color Level 4. This includes Chrome 62+, Firefox 49+, Safari 10+, and Edge 79+. For older browser support, use the rgba() function instead.

What is the difference between RGBA and HSLA?

RGBA defines colors using Red, Green, Blue channels (0-255) plus alpha. HSLA uses Hue (0-360°), Saturation (0-100%), Lightness (0-100%) plus alpha. HSLA is more intuitive for selecting color variations (lighter, darker, more saturated), while RGBA maps directly to how screens display color.

How does alpha work in hex?

In 8-digit hex format, the last two digits represent the alpha channel. 00 = fully transparent, FF = fully opaque. Common values: 80 ≈ 50% opacity, BF ≈ 75%, 40 ≈ 25%. The conversion formula is: hex_alpha = Math.round(alpha * 255).toString(16).

What is the difference between hex and RGB?

Hex (#FF0000) and RGB (rgb(255,0,0)) represent the same colors using different notation. Hex uses base-16 numbers, RGB uses decimal 0-255 values. They are interchangeable for any color. Hex is more compact in CSS code, while RGB is easier to read and manipulate programmatically.

How to Convert RGBA to Hex

Converting RGBA to hexadecimal involves translating each color channel from decimal (base-10) to hexadecimal (base-16) notation. The formula for each channel is:

Hex digit 1=value÷16\text{Hex digit 1} = \lfloor \text{value} \div 16 \rfloor
Hex digit 2=valuemod16\text{Hex digit 2} = \text{value} \mod 16

For the alpha channel, first multiply the 0-1 value by 255, then convert the result to hex:

Alphahex=toHex(Math.round(α×255))\text{Alpha}_{hex} = \text{toHex}(\text{Math.round}(\alpha \times 255))

Worked Example: rgba(255, 128, 0, 0.5)

1. Convert each RGB channel:

  • R: 255÷16=15 remainder 15FF255 \div 16 = 15 \text{ remainder } 15 \Rightarrow \text{FF}
  • G: 128÷16=8 remainder 080128 \div 16 = 8 \text{ remainder } 0 \Rightarrow \text{80}
  • B: 0÷16=0 remainder 0000 \div 16 = 0 \text{ remainder } 0 \Rightarrow \text{00}

2. Convert alpha channel:

  • 0.5×255=127.51280.5 \times 255 = 127.5 \approx 128
  • 128÷16=8 remainder 080128 \div 16 = 8 \text{ remainder } 0 \Rightarrow \text{80}

Result:

6-digit hex: #FF8000 (without alpha)

8-digit hex: #FF800080 (with alpha)

Common RGBA to Hex Conversions

Reference table for common colors with their RGBA values, 6-digit hex codes, and 8-digit hex codes:

ColorRGBAHex8-digit Hex
Whitergba(255,255,255,1)#FFFFFF#FFFFFFFF
Blackrgba(0,0,0,1)#000000#000000FF
Redrgba(255,0,0,1)#FF0000#FF0000FF
Red 50%rgba(255,0,0,0.5)#FF000080
Greenrgba(0,128,0,1)#008000#008000FF
Bluergba(0,0,255,1)#0000FF#0000FFFF
Blue 50%rgba(0,0,255,0.5)#0000FF80
Yellowrgba(255,255,0,1)#FFFF00#FFFF00FF
Cyanrgba(0,255,255,1)#00FFFF#00FFFFFF
Magentargba(255,0,255,1)#FF00FF#FF00FFFF
Orangergba(255,165,0,1)#FFA500#FFA500FF
Purplergba(128,0,128,1)#800080#800080FF
Grayrgba(128,128,128,1)#808080#808080FF
Navyrgba(0,0,128,1)#000080#000080FF
Coralrgba(255,127,80,1)#FF7F50#FF7F50FF

Understanding Alpha Channel in Hex

The 8-digit hex format (#RRGGBBAA) extends the standard 6-digit format by appending two hexadecimal digits for the alpha (transparency) channel. The alpha digits range from 00 (fully transparent) to FF (fully opaque).

Common Alpha Values

OpacityAlpha (0-1)Decimal (0-255)Hex
100%1.0255FF
75%0.75191BF
50%0.512880
25%0.256440
10%0.1261A
0%0.0000

The 8-digit hex format is part of the CSS Color Level 4 specification and is supported in all modern browsers. When the alpha value is FF (fully opaque), the 8-digit code is functionally identical to the 6-digit version. For example, #FF0000FF renders the same as #FF0000.

RGBA vs Hex: Key Differences

FeatureRGBAHex
NotationDecimal (0-255)Hexadecimal (00-FF)
Alpha supportBuilt-in (0-1)8-digit format (#RRGGBBAA)
ReadabilityMore human-readableMore compact
CSS syntaxrgba(255, 0, 0, 0.5)#FF000080
Programmatic useEasier to manipulate valuesEasier for string comparison
Design toolsUsed in some color pickersStandard in Figma, Sketch, etc.

CSS Color Formats Comparison

CSS supports multiple color formats, each with different strengths. Here is a comparison of the most commonly used formats:

FormatSyntax ExampleAlphaBest For
HEX#FF00008-digit onlyCompact CSS, design tools
RGBrgb(255, 0, 0)NoProgrammatic manipulation
RGBArgba(255, 0, 0, 0.5)Yes (0-1)Overlays, transparency effects
HSLhsl(0, 100%, 50%)NoIntuitive color selection
HSLAhsla(0, 100%, 50%, 0.5)Yes (0-1)Theme variations, palettes
OKLCHoklch(0.63 0.26 29)Yes (/ 0.5)Perceptually uniform colors

Related Tools