HEX to RGBA Converter

Turn any hex color into RGBA and control opacity. Use the slider or presets, watch the checkerboard preview, then copy the value straight into your stylesheet.

%
RGBArgba(52, 152, 219, 1)
HEX#3498DB
RGBrgb(52, 152, 219)
HSLAhsla(204, 70%, 53%, 1)

CSS

background-color: rgba(52, 152, 219, 1);
color: rgba(52, 152, 219, 1);
border-color: rgba(52, 152, 219, 1);

A modal backdrop needs black at 50 percent, not black. A hover state needs the brand blue at 12 percent, not a lighter blue. HEX alone cannot say either of those things. RGBA can.

Paste a six-digit hex code above, drag the opacity slider, and the tool rebuilds the color as rgba(r, g, b, a) as you type. The checkerboard behind the preview is there so a fully transparent color reads as "see-through," not as a blank box.

Where hex runs out of room

A hex code like #3498DB stores exactly three numbers: red, green, and blue. There is no fourth slot for transparency. CSS added that slot with two newer formats, rgba() and its cousin hsla(), each carrying an alpha channel from 0 (invisible) to 1 (solid). This converter reads your hex, works out the RGB channels behind it, then lets you set that fourth number with a slider instead of typing a decimal from memory.

Four places this gets used

Opacity isn't the same lever

CSS opacity fades a whole element, text and children included. RGBA fades one color value. Set opacity: 0.5 on a card and its heading, icon, and border dim together. Set background-color: rgba(52, 152, 219, 0.5) instead and only the background softens, the heading sitting on top of it stays fully readable.

Reach for RGBA when only the background, border, or shadow needs to fade. Reach for opacity when the whole element, children included, should disappear together, such as a toast notification leaving the screen. CSS also offers color-mix(in srgb, #3498DB 50%, transparent), which lands on the same result through different syntax. It works in current browsers, but not in anything shipped before 2023, so RGBA still covers far more projects.

What this tool won't catch

The hex field only accepts six digits. Three-digit shorthand like #3AF and eight-digit hex-with-alpha like #3498DBCC both need expanding to six digits first. The converter does not expand shorthand for you.

A lower alpha value can quietly break contrast too. A blue that passes WCAG AA at full opacity can fail it at 40 percent once it blends with whatever sits behind it, because the visible color depends on the background as much as the number on the slider. Run anything used for body text or buttons through the contrast checker after you drop the opacity, not before.

One rounding note: the slider works in whole percent, so 33% becomes exactly 0.33 in the output. CSS accepts more decimal places than that, but the extra precision rarely changes how a color renders on screen.

Questions about hex, alpha, and RGBA

Short answers for the details that come up once you start pasting RGBA into real CSS.

Does rgba() work in every browser I need to support?

Yes. rgba() has full support in every browser still in common use, including old versions of Internet Explorer. It is safer to rely on than color-mix(), which only reached browsers in 2023.

Can I go the other way, from RGBA back to a plain hex code?

A pure hex code has no room for alpha, so an RGBA value with anything less than full opacity has no exact hex equivalent. If you only need the color without transparency, drop the alpha and use the HEX to RGB Converter or RGB to HEX Converter in the opposite direction.

Why does the hex field cap at six characters?

Six digits is the standard, unambiguous hex format: two digits each for red, green, and blue. Three-digit shorthand and eight-digit hex-with-alpha both exist, but this converter keeps to the six-digit form so the RGB math stays exact.

Does a low alpha value break accessibility on its own?

It can. Lowering alpha lets whatever sits behind the element show through and change the effective contrast, sometimes enough to drop a passing color below WCAG AA. Check the result with the contrast checker whenever the affected element carries text.

What is the difference between the RGBA and HSLA values shown here?

Both describe the same color and the same alpha channel, just with different channels: RGBA uses red, green, blue, and alpha, while HSLA uses hue, saturation, lightness, and alpha. Use whichever one matches the rest of your stylesheet.

Does this tool store or upload the color I enter?

No. Every conversion happens in your browser with JavaScript. Nothing you type here is sent anywhere.