FormatterHQ

HEX to RGBA Converter

Convert hex color codes to CSS rgba() values. Six-digit codes become fully opaque; eight-digit and four-digit codes keep their transparency as a decimal alpha.

Loading tool…
Ready.

How to use the HEX to RGBA Converter

  1. Type or paste a hex color into the HEX field, for example #0F766E, #0F766E80 or #abcd.
  2. The RGBA field updates as you type and shows rgba(r, g, b, a); codes without an alpha byte get alpha 1.
  3. Copy the result with the button next to the field. For a different opacity, drag the Alpha (opacity) slider or edit the last number in the RGBA field.

Convert HEX to RGBA with alpha

This HEX to RGBA converter turns hex color codes into CSS rgba() values, including the transparency stored in eight-digit hex. A plain #RRGGBB code becomes fully opaque with alpha 1, while #RRGGBBAA keeps its alpha as a decimal between 0 and 1.

How the alpha byte becomes a decimal

In an eight-digit code the last pair is alpha. Like the color pairs, it is a byte from 00 to FF, and CSS alpha is that byte divided by 255. The tool rounds the result to three decimal places.

#0F766E80
0F = 15   76 = 118   6E = 110   80 = 128
alpha = 128 / 255 = 0.502
→ rgba(15, 118, 110, 0.502)

Notice that 80 gives 0.502, not exactly 0.5. Because 255 is odd, no byte lands precisely on one half. The table lists the alpha bytes you will meet most often.

Hex byteDecimalrgba() alpha
FF2551
E62300.902
CC2040.8
BF1910.749
991530.6
801280.502
661020.4
40640.251
33510.2
1A260.102
0000

Four-digit shorthand

CSS also allows #RGBA, where each digit is doubled just like in #RGB. #abcd expands to #aabbccdd: red 170, green 187, blue 204 and alpha 221 ÷ 255 = 0.867, giving rgba(170, 187, 204, 0.867).

Why convert to RGBA at all?

Current browsers understand eight-digit hex, so CSS doesn't strictly require the conversion. RGBA is simply easier to read and edit: 0.4 is obviously 40% opaque, while 66 needs a lookup. It is also the form many JavaScript libraries, canvas code and design handoff notes expect.

Once a color is in RGBA you can change its opacity by editing one number, for example turning a solid brand color into a faint tint for a hover background.

Watch the byte order

CSS puts alpha last. Android color resources and XAML put it first (#AARRGGBB). If you paste #800F766E from an Android project, this tool reads it the CSS way: red 128, green 15, blue 118 and alpha 0.431, a completely different color. Move the first pair to the end before converting.

To go back, the RGBA to HEX converter turns an alpha decimal into its byte again. If you only need the three color channels, HEX to RGB leaves the alpha out, and RGBA to RGB explains how to flatten a transparent color onto a background.

Frequently asked questions

What alpha does a 6-digit hex code get?
Alpha 1, meaning fully opaque. A six-digit code has no transparency information, so #0F766E becomes rgba(15, 118, 110, 1).
How do I write 50% opacity in hex?
The closest bytes are 80 (128, which is 0.502) and 7F (127, which is 0.498). Neither is exactly 0.5 because hex alpha has only 256 steps, but the difference is not visible.
Do all browsers support 8-digit hex colors?
All current major browsers support #RRGGBBAA and #RGBA in CSS. Very old browsers such as Internet Explorer do not, which is one reason rgba() is still widely used.
Is there a difference between rgba() and rgb() in CSS?
In the current CSS Color specification rgba() is an alias of rgb(), and both accept an alpha value. rgba() has been supported for longer, so it is the safer choice for older tools and browsers.
Can the alpha be written as a percentage?
CSS accepts percentage alpha in the space-separated syntax, for example rgb(15 118 110 / 50%). This tool always outputs a decimal from 0 to 1, which works in every syntax.

Last updated October 3, 2026

Related tools

RGBA to HEX Converter Convert RGBA colour values to HEX instantly, with a live colour swatch preview, colour picker and copy buttons. CMYK to RGBA Converter Convert CMYK colour values to RGBA instantly, with a live colour swatch preview, colour picker and copy buttons. HSL to RGBA Converter Convert HSL colour values to RGBA instantly, with a live colour swatch preview, colour picker and copy buttons. HSV to RGBA Converter Convert HSV colour values to RGBA instantly, with a live colour swatch preview, colour picker and copy buttons. RGB to RGBA Converter Convert RGB colour values to RGBA instantly, with a live colour swatch preview, colour picker and copy buttons. RGBA to CMYK Converter Convert RGBA colour values to CMYK instantly, with a live colour swatch preview, colour picker and copy buttons. HSL to CMYK Converter Convert HSL colour values to CMYK instantly, with a live colour swatch preview, colour picker and copy buttons. HSL to HEX Converter Convert HSL colour values to HEX instantly, with a live colour swatch preview, colour picker and copy buttons. HSL to HSV Converter Convert HSL colour values to HSV instantly, with a live colour swatch preview, colour picker and copy buttons. HSL to RGB Converter Convert HSL colour values to RGB instantly, with a live colour swatch preview, colour picker and copy buttons. HSV to CMYK Converter Convert HSV colour values to CMYK instantly, with a live colour swatch preview, colour picker and copy buttons. HSV to Colortone Converter Generate the tints, shades and tones of a HSV colour as a palette with swatches and ready-to-copy codes.