HEX to RGBA converter

To convert HEX to RGBA, turn each pair of hex digits into a 0–255 number and add an alpha from 0 to 1: #2563eb at 50% opacity is rgba(37, 99, 235, 0.5).

RGBArgba(37, 99, 235, 0.5)
8-digit HEX#2563EB80
CSSbackground-color: rgba(37, 99, 235, 0.5);

How to convert HEX to RGBA

  1. Split the six-digit hex into three pairs. For #2563eb that is 25, 63 and eb.
  2. Convert each pair from base 16 to a 0–255 number: 25 → 37, 63 → 99, eb → 235.
  3. Add an alpha from 0 to 1. At 50% opacity the result is rgba(37, 99, 235, 0.5), or the 8-digit hex #2563eb80.

Need the plain channels first? Use the HEX to RGB converter, then come back here for the alpha. Going the other way? The RGB to HEX converter turns rgba() back into a hex code, and the color format converters cover every other pair. Need the solid colour a transparent rgba() makes? Use the RGBA to HEX converter.

HEX opacity table

Alpha hex suffix for every 5% step, shown on #2563eb.
Opacity %Alpha (0–1)Hex suffixExample
100%1FF#2563ebFF
95%0.95F2#2563ebF2
90%0.90E6#2563ebE6
85%0.85D9#2563ebD9
80%0.80CC#2563ebCC
75%0.75BF#2563ebBF
70%0.70B3#2563ebB3
65%0.65A6#2563ebA6
60%0.6099#2563eb99
55%0.558C#2563eb8C
50%0.5080#2563eb80
45%0.4573#2563eb73
40%0.4066#2563eb66
35%0.3559#2563eb59
30%0.304D#2563eb4D
25%0.2540#2563eb40
20%0.2033#2563eb33
15%0.1526#2563eb26
10%0.101A#2563eb1A
5%0.050D#2563eb0D
0%0.0000#2563eb00

HEX to RGBA questions

How do I add opacity to a hex color?

Add two alpha digits to the end of a six-digit hex code, or convert the hex to rgba() and set the fourth value from 0 to 1. For example #2563eb at 50% opacity is #2563eb80 or rgba(37, 99, 235, 0.5).

What is the hex code for 50% opacity?

80. Half of 255 is 127.5, which rounds to 128, and 128 in hexadecimal is 80. So 50% opacity appends 80 to a six-digit hex, giving #2563eb80 for that blue.

RGBA or 8-digit HEX: which should I use in CSS?

Both work in every modern browser. Use rgba() when you want the alpha as a readable decimal, and 8-digit hex when you want one compact token for a design system or a CSS variable. The rendered color is the same.

Does opacity on rgba() affect child elements?

No. Alpha inside rgba() only fades that one color, so text and child elements keep their own opacity. The separate opacity property fades the whole element, children included, which is why rgba() is safer for overlays.

More color tools

Image tools

CSS generators

Image & SVG tools

Typography & units

More free tools

All free tools