Productivity and Utilities

Hex Opacity Calculator

Convert an opacity percentage to the two digit hex alpha code and back.

Your numbers

Convert

0 is fully transparent and 100 is fully opaque.

A six digit hex color such as #FF0000 to build the full eight digit code.

Result

80% opacity as hex alpha

CC

Alpha byte 204 of 255

Alpha byte
204 of 255
Alpha as hex
CC
8 digit hex color
#FF0000CC
rgba() form
rgba(255, 0, 0, 0.8)

Common opacity steps

OpacityHex alpha
0%00
10%1A
20%33
25%40
30%4D
40%66
50%80
60%99
70%B3
75%BF
80%CC
90%E6
100%FF
How this was calculated
  1. Alpha byte = opacity / 100 x 255 = 80 / 100 x 255 = 204, rounded half up to 204.
  2. Hex alpha = 204 written in base 16 with two digits = CC.
  3. The 8 digit code is the six digit color followed by the alpha: #FF0000CC.
  • Eight digit hex colors (#RRGGBBAA) are supported by current browsers. Because 255 does not divide evenly by 100, some percents land between two bytes, so the result is the nearest byte and the round trip can differ by a fraction of a percent.

Calculated using SumPanda.com · https://sumpanda.com/hex-opacity-calculator/

Results are estimates for general information. Verify important figures before relying on them.

Next step

How to use the hex opacity calculator

  1. Choose Percent to hex or Hex to percent.
  2. Enter the opacity from 0 to 100, or the two digit hex alpha from 00 to FF.
  3. Optionally enter a six digit hex color such as #FF0000 to build the full eight digit code and an rgba() value.
  4. Copy the code. The table lists common percentages.

Formula

alpha byte = round half up of (opacity % x 255 / 100)

hex alpha = the byte written as two base 16 digits

opacity % = alpha byte / 255 x 100

Eight digit hex color is #RRGGBBAA, where AA is the alpha byte. 00 is fully transparent and FF is fully opaque.

80 percent red

80% of 255 is 204, and 204 in base 16 is CC. So 80% opacity is CC, and the color #FF0000 becomes #FF0000CC. As rgba() it is rgba(255, 0, 0, 0.8).

50% of 255 is 127.5, which rounds half up to 128, written 80. Converting 80 back gives 128 / 255 x 100 = 50.2%, which shows why the round trip can differ by a fraction of a percent.

Why 255 and rounding matter

An alpha value is stored in one byte, so there are 256 possible levels from 0 to 255, not 101. Only a few percentages land exactly on a byte. Others, such as 33%, give 84.15, which rounds to 84, written 54. This tool uses round half up, so a value ending in .5 goes up.

Some tools truncate instead of rounding, and some design programs use their own tables, so you may see a one step difference in another tool. Both are valid, since the difference is below what the eye can tell.

Where eight digit hex works

Eight digit hex colors are part of the CSS color specification and are supported in current browsers, and four digit shorthand (#RGBA) exists too. Older systems and some design tools only accept rgba(), which is why the result is shown in both forms. Opacity applied to a color in this way affects only that color, while the CSS opacity property fades the whole element, text and children included.

Pick colors with the color picker, check legibility with the color contrast checker, and add effects with the text shadow generator or the box shadow generator.

Assumptions and limits

  • Opacity is a percent from 0 to 100 and hex alpha is two hex digits.
  • The byte is the opacity times 255 divided by 100, rounded half up.
  • Color input must be six hex digits, with or without the # sign.
  • Results assume the eight digit hex notation #RRGGBBAA.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

What is the hex code for 50 percent opacity?

It is 80. Half of 255 is 127.5, which rounds up to 128, and 128 in hex is 80.

How do I add opacity to a hex color?

Add the two digit alpha after the six digit color. For 80% red write #FF0000CC.

Why does 100 percent give FF?

100% of 255 is 255, which is FF in hex, the highest possible alpha value, meaning fully opaque.

Can I convert an alpha code back to a percent?

Yes. Choose Hex to percent and enter the two digits. The tool divides the value by 255 and shows the percent.