Hex Opacity Converter

Convert opacity percentages to two-digit HEX alpha values, or convert HEX alpha values back to opacity percentages.

Last updatedHow we build & check our tools

How This Tool Works

The Hex Opacity Converter maps an opacity percentage to the two-character alpha channel used at the end of an 8-digit CSS HEX color. Enter a value from 0% to 100% and the tool converts it to a value from 00 to FF.

The calculator uses round(opacity / 100 x 255), then formats the result as uppercase hexadecimal. Use the swap control to convert a HEX alpha value, such as 80, back to its approximate opacity percentage.

  • Input: Opacity percent or two-digit HEX alpha.
  • Formula: alpha = round(percent / 100 x 255).
  • Output: CSS-ready alpha value, such as 40, 80, BF, or FF.

Why This Matters

Eight-digit HEX colors use the final two characters for transparency, but those values are base-16 channel values rather than percentages. Converting the alpha channel correctly avoids common off-by-one mistakes when moving between design tools, CSS, and code.

For example, 50% opacity is 80, not 50, because the alpha channel runs from decimal 0 to 255 before it is written in hexadecimal.

Common Mistakes to Avoid

  • Do not append a percentage to HEX: CSS expects #RRGGBBAA, such as #2563EB80, not #2563EB50%.
  • Do not treat 50% as hex 50: 50% opacity rounds to decimal 128, which is hex 80.
  • Keep the color separate: this page converts only the alpha channel, not the red, green, and blue color channels.

Frequently Asked Questions

Common questions about the Hex Opacity Converter

Add two digits at the end: #RRGGBBAA. FF = opaque, 00 = transparent.

Sources & References

Color models and conversion (sRGB, HSL, …)

Definitions and conversion formulas for sRGB, HSL, HWB, Lab, and related color spaces.