Hex to RGBA Converter

50% opacity
#

Paste a 6-digit hex, or an 8-digit hex to read its alpha automatically

0% (transparent)100% (opaque)

Quick presets

How the Alpha Is Calculated

alpha (0–1) = percent ÷ 100
alpha byte = round(alpha × 255)
alpha hex = byte in base-16

50% → 0.50 → round(0.50 × 255) = 12880

RGBA Value

rgba(255, 87, 51, 0.5)

8-digit hex

#FF573380

Modern rgb() with alpha

rgb(255 87 51 / 50%)

Solid hex (no alpha)

#FF5733

How It Blends Over a Background

over white

rgb(255, 171, 153)

over black

rgb(128, 44, 26)

Same alpha, two backgrounds, two different visible colors.

CSS Snippet

background-color: rgba(255, 87, 51, 0.5);
background-color: #FF573380;

Opacity → Decimal → Hex Alpha Reference

OpacityDecimal (0–1)Byte (0–255)Hex AlphaApply
100%1.00255FF
90%0.90230E6
75%0.75191BF
60%0.6015399
50%0.5012880
40%0.4010266
25%0.256440
10%0.10261A
5%0.05130D
0%0.00000

Click any "Use" link to apply that opacity to the color above.

How to Use This Tool

  1. 1.Type or paste a hex code into the field — use 6 digits for a solid color, or 8 digits to load its alpha automatically.
  2. 2.Drag the alpha slider (or tap a preset like 25% or 75%) to set opacity. The checkerboard preview shows exactly how transparent the color is.
  3. 3.Read the rgba() value in the blue panel, plus the matching 8-digit hex and modern slash syntax below it.
  4. 4.Check the "over white" and "over black" swatches to see the actual color your users will see on each background.
  5. 5.Click any Copy button to grab the format you need for your CSS or design tool.

Rate this tool

Hex to RGBA: How Alpha Transparency Actually Behaves in CSS

A hex to RGBA converter adds an alpha channel to a color — and that single extra value behaves in ways that catch out most developers the first time. You set a button background to rgba(255, 87, 51, 0.5), it looks perfect on your white mockup, then it turns muddy on a dark hero section. Nothing in your code changed. The color did exactly what alpha is supposed to do: it blended with whatever was behind it. This page explains the math underneath that blend, the three ways to write the same opacity, and the bugs that make transparency look wrong.

One orange swatch shown at 100, 75, 50, 25, and 0 percent opacity over a checkerboard, each step labeled with its RGBA value and 8-digit hex alpha pair

What RGBA Adds That Hex Alone Can't

A standard hex code like #FF5733 carries three numbers: red, green, and blue, each from 0 to 255. RGBA adds a fourth — alpha — that controls opacity. Alpha 1 is fully opaque (you see the pure color), alpha 0 is fully transparent (you see straight through it), and anything in between mixes the color with its background.

A solid hex code physically can't express this. Six hex digits only have room for three channels. To get transparency you either jump to the 8-digit hex form (#FF573380) or use the rgba() CSS function. Both encode the same four numbers; they just write them differently. If you only need the three solid channels, our hex to RGB converter covers that case without the alpha math.

0 to 1, 0 to 255, and 00 to FF: Three Ways to Write One Alpha

The confusing part of alpha is that it has three notations, and they don't look alike. CSS rgba() wants a decimal from 0 to 1. The 8-digit hex form wants a two-character byte from 00 to FF. And design tools usually show you a percentage. They all describe the same opacity.

To go from a percentage to a hex byte: divide by 100 to get the decimal, multiply by 255, round to the nearest whole number, then convert to base-16. So 50% becomes 0.5, then 0.5 × 255 = 127.5, which rounds to 128, which is 80 in hex. That rounding is why 50% is 80 and not the 7F (127) you might expect.

OpacityDecimalByteHex
100%1.0255FF
75%0.75191BF
50%0.512880
25%0.256440
10%0.1261A
0%0.0000

Reading Alpha Straight From 8-Digit Hex

An 8-digit hex code is just a 6-digit code with two extra characters tacked on the end for alpha: #RRGGBBAA. Take #2563EBBF. The first six characters give RGB 37, 99, 235 — the same blue you'd get from #2563EB. The last pair, BF, is the alpha: BF equals 191 in decimal, and 191 ÷ 255 = 0.749, which is 75% opacity. So the whole thing reads as rgba(37, 99, 235, 0.75).

There's a 4-digit shorthand too. #F538 expands to #FF553388 — each character doubles, alpha included. Browser support for 8-digit hex is universal in modern engines, but it landed later than rgba(), so very old codebases stick with the function form. Paste either form into the tool above and it pulls the alpha out for you.

Why 50% Opacity Isn't Half a Color

Here's the part competitors skip. When you put a semi-transparent color on screen, the browser doesn't show your color at all — it shows a blend of your color and the background. The formula is alpha compositing:

visible channel = foreground × alpha + background × (1 − alpha)

Run rgba(255, 87, 51, 0.5) — our orange at 50% — over a white background (255, 255, 255). The red channel stays 255 (255 × 0.5 + 255 × 0.5). Green becomes 87 × 0.5 + 255 × 0.5 = 171. Blue becomes 51 × 0.5 + 255 × 0.5 = 153. The visible color is rgb(255, 171, 153) — a pale salmon, not orange.

Now drop the same orange over black (0, 0, 0). Red: 255 × 0.5 + 0 = 128. Green: 87 × 0.5 = 44. Blue: 51 × 0.5 = 26. The visible color is rgb(128, 44, 26) — a dark brick. Identical alpha, identical foreground, two completely different results. That's why the "over white" and "over black" swatches in the tool exist: the alpha number alone never tells you what the user actually sees. This also matters for accessibility — run the blended color, not the source color, through our WCAG contrast checker to get a true ratio.

rgba() vs. the opacity Property

These two get confused constantly, and the difference matters. rgba() sets the transparency of a single color value. The CSS opacity property fades an entire element and everything nested inside it.

Aspectrgba() / 8-digit hexopacity property
What fadesOnly the one color (e.g. background)The whole element + all children
Text on topStays fully solid and crispFades with everything else
Stacking contextNo new context createdCreates a new stacking context
Best forTranslucent panels behind sharp textFade-in/out animations of full elements

If you want a frosted card with a see-through background but perfectly readable text, you need rgba() on the background-color — never opacity: 0.5 on the card, because that would wash out the text too.

The Gray Fringe Bug When You Fade to Transparent

Try fading a color to nothing in a gradient: linear-gradient(to right, #FF5733, transparent). In Safari and older engines you'll often see an ugly gray or dark band near the transparent end. The reason is sneaky: the CSS keyword transparent is defined as rgba(0, 0, 0, 0) — transparent black. As the gradient interpolates toward it, the RGB channels slide toward 0 (black) even as alpha drops, so the midpoint blends in dark pixels.

The fix is to fade to the same color at zero alpha, keeping the RGB intact: linear-gradient(to right, #FF5733, rgba(255, 87, 51, 0)) or the hex form #FF573300. Now only the alpha changes and the color stays clean all the way down. The tool above gives you the exact rgba(…, 0) string when you drag the slider to 0%. Our CSS gradient generator applies this fix automatically for fade-out stops.

Mistakes That Make Transparency Look Wrong

Writing alpha as a percent inside rgba(). rgba(255, 87, 51, 50) is invalid — the legacy comma syntax expects a 0–1 decimal, so 50 clamps to 1 (fully opaque) and your transparency silently disappears. Use 0.5, or switch to the modern slash form rgb(255 87 51 / 50%) where percentages are allowed.

Confusing the alpha byte's position. Some platforms (older Android, certain Java APIs) use #AARRGGBB with alpha first. CSS uses #RRGGBBAA with alpha last. Paste an #80FF5733 meant for Android into CSS and you get a near-opaque teal instead of a half-transparent orange.

Expecting 50% alpha to be 7F. Half of 255 is 127.5. It rounds up to 128, which is 80, not 7F. Off-by-one alpha values usually trace back to flooring instead of rounding.

Stacking transparent layers and expecting linear results.Two 50% layers don't make 100% — they make 75% combined opacity (1 − 0.5 × 0.5). Transparency multiplies, it doesn't add.

Practical Tips for Working With Alpha

  • Pre-blend for performance-critical UI. If a translucent overlay always sits on the same solid background, compute the composited color once and use a solid hex. The browser skips the per-frame blend, which helps on long scrolling lists.
  • Use currentColor with a relative alpha. Modern CSS supports rgb(from currentColor r g b / 50%), letting one rule produce a 50% tint of whatever the text color happens to be — handy for theme systems.
  • Keep brand colors as solid tokens, derive alpha at use. Store --brand: #2563EB once, then write rgb(from var(--brand) r g b / 0.1) for subtle backgrounds. One source of truth, many opacities.
  • Watch the 1A trap. 10% opacity is 1A in hex (26), which looks like part of a color, not an alpha. When debugging an 8-digit hex, always count to eight characters before assuming the last pair is alpha.
  • Reach for HSL when tweaking, hex when shipping. Adjusting lightness is easier in HSL than juggling three hex pairs — our hex to HSL converter handles that step. The official syntax for all of this lives in the MDN rgb() reference and the W3C CSS Color 4 alpha specification.
Marko Sinko
Marko SinkoTechnical Tools Editor

Croatian developer with a Computer Science degree from University of Zagreb and expertise in advanced algorithms. Marko builds and verifies the technical tools, number system converters, and scientific calculators across UnitCalcTools, ensuring mathematical precision and developer-friendly interfaces.

Last updated: June 22, 2026LinkedIn

Frequently Asked Questions

#FF5733 at 50% opacity is rgba(255, 87, 51, 0.5). The hex pairs convert to red 255, green 87, and blue 51, while the alpha is written as a decimal from 0 to 1, so 50% becomes 0.5. As an 8-digit hex it would be #FF573380, because 80 in hex equals 128, which is the closest byte value to half of 255.
Split the eight characters into four pairs: FF, 57, 33, and 80. The first three convert to RGB 255, 87, 51 exactly as a normal hex code. The fourth pair, 80, is the alpha — divide its decimal value (128) by 255 to get 0.50. The full result is rgba(255, 87, 51, 0.5).
rgba() makes only the element's own color semi-transparent, so text and borders stay fully solid while the fill shows through. The opacity property fades the entire element and every child inside it, including text, shadows, and nested images. Use rgba() for a translucent background behind sharp text; use opacity only when you want the whole element and its contents to fade together.
75% opacity is BF in hex. Multiply 0.75 by 255 to get 191.25, round to 191, then convert 191 to hex, which is BF. So a 75% transparent version of #2563EB is written as #2563EBBF in 8-digit hex or rgba(37, 99, 235, 0.75) in standard CSS.
A semi-transparent color is mixed with whatever sits behind it, so the visible result changes with the background. rgba(255, 87, 51, 0.5) over white renders as roughly rgb(255, 171, 153), but over black it renders as rgb(128, 44, 26). The alpha never changes — only the blend partner does. Always preview transparent colors on the actual background they will sit on.
Not strictly. Modern CSS lets you write rgb(255 87 51 / 50%) with the alpha after a slash, and rgba() is now just an alias kept for compatibility. Both produce identical results in every current browser. Stick with rgba() only if you must support very old browsers like Internet Explorer 11, which never understood the slash syntax.
Set the alpha to 0 while keeping the same RGB channels — for example rgba(255, 87, 51, 0) or #FF573300, not the keyword transparent. The transparent keyword resolves to rgba(0, 0, 0, 0), which is transparent black, and that can leave a gray or dark fringe when used as a gradient endpoint. Matching the RGB to your visible color avoids the fringe.

Related Tools