RGBA Color Converter

8-digit hex code—
RGBA string—
Over white—
Over black—
Opacity—

How RGBA Color Converter is calculated: Hex8 = #RRGGBBAA with alpha × 255; blended channel = alpha × foreground + (1 − alpha) × background; opacity % = alpha × 100.

What is a RGBA color converter?

A RGBA color converter converts an RGB colour with an alpha — an opacity — into the forms web developers use: an 8-digit hex code, an rgba() string, and the colour it makes over white and over black. Enter the red, green, blue, and alpha values, and it gives you the answer at once.

People use it for far more than curiosity. Web developers use it every day, because CSS colours are often written with transparency — a red overlay at half opacity, a shadow that lets the background show through. Anyone who has ever written rgba(255, 0, 0, 0.5) and wondered what colour it actually makes has needed this conversion.

The converter runs in your browser and never sends anything anywhere. There is no reason for a simple conversion to collect personal information. Type the value, read the answer, and close the page — nothing is stored.

The answer is immediate and exact — there is no rounding in a time conversion, and the same input always gives the same answer. That is the difference between a converter and a calculator: nothing is estimated, and nothing is close enough.

How RGBA colour works

RGBA adds a fourth channel to RGB: alpha, the opacity, from 0 (fully transparent) to 1 (fully opaque). The 8-digit hex code writes it as #RRGGBBAA — the red, green, blue, and alpha as two hex digits each. An alpha of 0.5 is 128 in decimal, which is 80 in hex, so red at half opacity is #FF000080.

The 8-digit hex code is the main figure for CSS: #FF000080 for the default. The rgba() string is the same colour in the form CSS uses most, and the two blended colours show what it actually looks like over the two extremes.

The same colour over white and over black can look like two different colours, which is the point of showing both. A half-transparent red over a white page is a pink; the same red over a black page is a dark red — and a design that works on one background can fail on the other.

The whole conversion is a few lines of arithmetic, and it runs in your browser, which is why the answer appears as you type. There is no server, no lookup table, and no database — just the rules of the two systems, applied to your input.

Alpha — the input that changes the answer

Alpha is the most important input. An alpha of 1 means fully opaque — the colour is exactly what you entered — and an alpha of 0 means fully transparent, so the background shows through completely and the colour is invisible. Everything in between is a blend, and the blend is what the converter calculates.

The second input trap is the hex code. An 8-digit hex code is #RRGGBBAA — the alpha comes last, not first. Some systems write it as #AARRGGBB, with the alpha first, and the two are not interchangeable — #FF000080 is red at half opacity, while #80FF0000 is a different colour entirely in the other order.

The third trap is the background. A transparent colour has no colour of its own — it is only a blend with whatever is behind it. The converter shows the result over white and over black, which are the two extremes, and any other background falls between them.

The calculator checks the input as you type. A value that cannot be read — a missing marker, a minute above 59, a day that does not exist — is rejected with a message, instead of being guessed at. A converter that guesses is worse than one that says it does not know.

A worked example

First, the default on this page. Red (255, 0, 0) at 0.5 alpha: the 8-digit hex is #FF000080, the rgba string is rgba(255, 0, 0, 0.5), the colour over white is #FF8080, and the colour over black is #800000. The opacity is 50%.

Second, a blue at a quarter opacity: (37, 99, 235) at 0.25. The 8-digit hex is #2563EB40, the rgba string is rgba(37, 99, 235, 0.25), the colour over white is #C9D8FA, and the colour over black is #09193B. The opacity is 25%, so the background dominates — and the blue is barely visible over white.

Third, black at full opacity: (0, 0, 0) at 1. The 8-digit hex is #000000FF, the rgba string is rgba(0, 0, 0, 1), and the colour over white and over black is #000000 in both cases. At full opacity the background does not matter at all, which is the point of an alpha of 1.

Every example above uses the same rules, and you can check each one by hand. The arithmetic is short enough to do on paper, which is the point — a converter you can verify is a converter you can trust.

Why it matters, and who uses it

Web developers use it for overlays and shadows. A modal dialog is often a black overlay at 0.5 alpha over the page, and a card shadow is black at 0.1 or 0.2. The converter shows what those overlays actually look like over white and over black, before the code is written.

Designers use it for glass effects and gradients. A translucent panel over a photograph is a colour at a low alpha, and the result depends on the photograph behind it — which is why the converter shows the two extremes, white and black, rather than pretending there is one answer.

Then there is the plain usefulness of an exact answer. Knowing that red at half opacity is #FF8080 over white and #800000 over black — and that the hex code is #FF000080 — is a small piece of knowledge that keeps a design honest, and it is exact, not an estimate.

The answer is also easy to check, which is the point of showing the working. Pick a value you know — midnight, noon, half an hour — and the figures should match what you remember. If they do, the converter is working.

RGBA Color Converter vs RGB to HEX converter

These two tools answer different questions. An RGB to HEX converter changes a colour between two ways of writing the same RGB values — (255, 0, 0) and #FF0000 are the same colour, written differently. This converter adds the alpha channel: it turns an RGB colour with an opacity into an 8-digit hex code, an rgba() string, and the blended colour over a background. The difference is the transparency: the RGB to HEX converter has no alpha, and this one is built around it. If the question is 'what is (255, 0, 0) as a hex code', the RGB to HEX converter is the tool; if the question is 'what is red at half opacity', this is the tool.

If the question is 'what is red at half opacity', use this converter. If the question is 'what is (255, 0, 0) as a hex code', use the RGB to HEX converter instead. Use this converter for transparent colours and the RGB to HEX converter for opaque ones. If the question is what a colour looks like, a color picker shows it on screen.

Both are the same kind of tool — a value in, a value out, worked out in your browser. A color picker shows any colour on screen and gives its hex code, which is the tool to use when you want to see the colour rather than convert it. And a color blender mixes two colours at a ratio, which is the tool to use when the colour is a blend of two colours rather than a colour over a background.

The two tools share the same idea: a value in, a value out, worked out in your browser. The difference is only in what is being converted, and in which direction the answer points.

Common mistakes

The first mistake is the hex order. An 8-digit hex code is #RRGGBBAA — the alpha comes last. Some systems write #AARRGGBB, with the alpha first, and the two are not interchangeable — #FF000080 and #80FF0000 are different colours.

Second: the background. A transparent colour has no colour of its own — it is only a blend with whatever is behind it, and the same alpha looks different over white and over black. Third: the alpha scale — 0.5 is half opacity, not 50 in a 0–255 scale, and an alpha of 50 would be fully opaque.

Fourth: the rounding. An alpha of 0.5 is 128 in decimal, which is 80 in hex — and the converter rounds to the nearest whole number, so an alpha of 0.25 is 64, which is 40 in hex. The difference is one step in 255, and it is invisible.

The mistakes above are the ones people actually make, and they are all small. A converter that shows its working lets you catch them before they matter, which is the whole reason for using one.

How to use this RGBA color converter

Using it takes seconds. Enter the red, green, blue, and alpha values — the default is red (255, 0, 0) at 0.5. The results update live: the 8-digit hex code, the rgba() string, the colour over white, the colour over black, and the opacity as a percentage. The results update live as you type.

The 8-digit hex code is the main figure for CSS: #FF000080 for the default. The rgba() string is the same colour in the form CSS uses most, and the two blended colours show what it actually looks like over the two extremes.

Everything runs in your browser, so nothing you enter leaves your device. One practical tip: always check a translucent colour over both a light and a dark background. A red at 0.5 looks like a pink over white and a dark red over black — and a design that works on one can fail on the other.

Everything runs in your browser, so nothing you enter leaves your device, and the answer is the same every time you enter the same value. There is nothing to save, nothing to sign up for, and nothing to wait for.

Frequently Asked Questions

#FF000080. An alpha of 0.5 is 128 in decimal, which is 80 in hex, so the 8-digit hex code is #FF000080. The rgba() string is rgba(255, 0, 0, 0.5), and the colour over white is #FF8080.

#FF8080, a pale red. Each channel is the foreground times the alpha plus the background times one minus the alpha: 0.5 × 255 + 0.5 × 255 = 255 for red, and 0.5 × 0 + 0.5 × 255 = 128 for green and blue.

The opacity, from 0 (fully transparent) to 1 (fully opaque). An alpha of 1 means the colour is exactly what you entered, and an alpha of 0 means it is invisible — the background shows through completely.

Last, in the standard CSS form: #RRGGBBAA. Red at half opacity is #FF000080. Some systems — notably Android — write #AARRGGBB with the alpha first, so always check which order your tool expects.

More free tools

More calculators and utilities from Sortrun — free, no sign-up.