HEX to RGBA

Convert 6- and 8-digit HEX colors to CSS rgba() with alpha.

Type a HEX value or pick a color – the result updates instantly.

​

Preview

HEX to RGBA Converter

This converter turns HEX color codes – including the 8-digit form with a built-in alpha byte – into a CSS rgba() value. Enter #1E90FF80 and you get rgba(30, 144, 255, 0.502): the same Dodger Blue at roughly half opacity. Six-digit codes convert with an alpha of 1, and the result table also shows HEX with alpha, HSL, HSV, and CMYK.

Reading the alpha byte

An 8-digit HEX code is #RRGGBBAA. The first six digits are the color, and the final pair is opacity on a 0–255 scale. To get the decimal alpha that rgba() expects, divide that byte by 255. Four-digit shorthand works the same way: #F608 expands to #FF660088, which is rgba(255, 102, 0, 0.533).

Alpha HEX Byte rgba() alpha
00 0 0
33 51 0.2
40 64 0.251
80 128 0.502
BF 191 0.749
CC 204 0.8
FF 255 1

Worked example

Take #1E90FF80. Split it into pairs: 1E = 1 × 16 + 14 = 30, 90 = 9 × 16 = 144, FF = 255, and the alpha pair 80 = 128. Dividing 128 by 255 gives 0.502, so the CSS value is rgba(30, 144, 255, 0.502). If you want a clean 0.5, write the rgba() value by hand – the HEX form cannot represent exactly 50%.

Where RGBA is the better choice

  • Overlays and scrims: a dark layer like rgba(0, 0, 0, 0.6) over a hero image is easier to adjust than #00000099.
  • Shadows: box-shadow values are usually tuned by the alpha number, not by a hex pair.
  • Design handoff: tools such as Figma export 8-digit HEX, while many style guides and JavaScript canvas code use rgba().

Need to go the other way? The RGB to HEX converter accepts rgba() input and produces an 8-digit code. For plain opaque colors, the HEX to RGB page is all you need.

Frequently Asked Questions

The last two digits are read as a number from 0 to 255 and divided by 255. For #1E90FF80, 80 in hex is 128, and 128 / 255 = 0.502, so the result is rgba(30, 144, 255, 0.502).

A 6-digit code has no transparency information, so it is treated as fully opaque and converts with an alpha of 1, for example #1E90FF becomes rgba(30, 144, 255, 1).

The alpha byte has 256 steps (0 to 255), and 50% of 255 is 127.5, which is not a whole number. The closest bytes are 7F (0.498) and 80 (0.502), so neither is exactly 0.5.

Yes, all current browsers accept #RRGGBBAA and #RGBA in CSS. Converting to rgba() is still useful for older tooling, for readability, and for code that expects a decimal alpha value.