Hex Opacity: What is it & hex opacity table

Hex opacity is the two-digit alpha value appended to a standard 6-digit hex color code, turning #RRGGBB into #RRGGBBAA. The last two characters control transparency: 00 is fully transparent, FF is fully opaque, and everything between is a partial level of transparency.

To get a transparent hex code for any color, find the opacity percentage in the table below and append it to your hex color. Red (#FF0000) at 50% opacity becomes #FF000080. For a fully transparent hex code, use any color followed by 00, such as #00000000.

Using Hex Opacity in CSS

You can apply hex opacity to any CSS property that accepts a color value: backgrounds, borders, text, box shadows, and more. Just append the two-digit hex value to any existing color code.

/* Background with 50% opacity */
background-color: #0000FF80;

/* Text color at 70% opacity */
color: #333333B3;

/* Border at 25% opacity */
border: 1px solid #FF000040;

/* Box shadow with transparency */
box-shadow: 0 4px 6px #00000033;

CSS also supports a 4-digit shorthand format (#RGBA), where each digit is doubled. So #0F08 is the same as #00FF0088. This shorthand only works when each pair of digits is identical, so it’s less commonly used than the full 8-digit format.

One platform difference worth knowing: Android and Kotlin use the reversed format #AARRGGBB, where the alpha comes first. The table below still applies for the alpha portion; just swap its position when writing Android color values.

Hex Opacity Table

Here is a handy table to quickly find the opacity hex code to append to your hex color.

For example, to get 95% opacity, append F2 to your hex color. Red at 95% opacity: #ff0000f2.

The hex values use standard mathematical rounding (rounding 0.5 up). So 50% maps to 80 (128 in decimal, since 127.5 rounds up) rather than 7F (127). Some tools use truncation instead and show 7F for 50% and 3F for 25%. Both are valid CSS values. The visual difference is imperceptible.

Opacity Value (%)Hex Code
100FF
99FC
98FA
97F7
96F5
95F2
94F0
93ED
92EB
91E8
90E6
89E3
88E0
87DE
86DB
85D9
84D6
83D4
82D1
81CF
80CC
79C9
78C7
77C4
76C2
75BF
74BD
73BA
72B8
71B5
70B3
69B0
68AD
67AB
66A8
65A6
64A3
63A1
629E
619C
6099
5996
5894
5791
568F
558C
548A
5387
5285
5182
5080
497D
487A
4778
4675
4573
4470
436E
426B
4169
4066
3963
3861
375E
365C
3559
3457
3354
3252
314F
304D
294A
2847
2745
2642
2540
243D
233B
2238
2136
2033
1930
182E
172B
1629
1526
1424
1321
121F
111C
101A
917
814
712
60F
50D
40A
308
205
103
000

Hex Opacity vs. rgba() and the opacity Property

Three CSS approaches handle color transparency. They’re not interchangeable.

#RRGGBBAA hex notation applies transparency to a single color value. It works anywhere a color is accepted in CSS. The downside is readability: #FF000080 isn’t as clear as rgba(255, 0, 0, 0.5) at a glance.

rgba() and hsla() are the more readable alternatives. The alpha channel uses a 0-1 decimal (0.5 for 50%), so no hex conversion is needed. Both rgba() and 8-digit hex produce identical results; they’re different syntax for the same thing.

The CSS opacity property works differently. Setting opacity: 0.5 on an element makes the entire element transparent, including its children. Text inside a semi-transparent container will inherit the parent’s opacity. To keep text fully visible while making only the background transparent, use background-color with hex opacity or rgba() instead.

/* These produce identical results */
background-color: #FF000080;
background-color: rgba(255, 0, 0, 0.5);

/* This makes the entire element AND its children 50% transparent */
opacity: 0.5;

Understanding the Hexadecimal System

Decimal is base 10: digits run from 0 to 9. Hexadecimal is base 16, so it adds six more symbols: A, B, C, D, E, and F. That gives each digit position 16 possible values instead of 10.

A single hex digit represents values from 0 to F, where F equals 15 in decimal. Two hex digits together cover 0 to 255 (FF in hex). That range is why the opacity channel fits in exactly two characters.

Valid two-digit hex values include 00, 01, 99, 9D, CC, E4, and F5. Letters are case-insensitive in CSS, so #ff0000f2 and #FF0000F2 are the same color.


Browser Support

8-digit hex color notation is well-supported across all modern browsers. CSS #RRGGBBAA notation has had broad support since 2016 in Chrome and Firefox, and since 2019 in all major browsers including Safari. If you need to support Internet Explorer, use rgba() instead.

1 thought on “Hex Opacity: What is it & hex opacity table”

  1. I know I am being a bit nit-picky but should 25% not be 3F,
    50% be 7F, and 100% be FF?
    The issue is the percentages are based on 1-100 whereas the hex values are zero based from 00 to FF. We cannot have hex 100 which would be 3 digits where only 2 digits are allowed – you could do that with HSL(degrees, saturation %, luminosity %) but not with #FFFFFF2F, for example.
    In the grand scope of things it doesn’t really matter, I suppose and most people are really only going to use 25%, 50%, and 75%.

    Reply

Leave a Comment