Percent to Hex

 

  • Percent 0 - 100%
  • RGB 0 - 255
  • Hex 00 - ff

At one point I need to figure out how to represent a percent value as a hex value in order to define a color and opacity in RGBA (or ARGB) format. I found some charts and tables that listed out various increments of values, but ended up building a calculator that converts percent to hex.

So, for example, if you want black (#000000) at 35% opaque, enter 35 in the percent field above and it returns 59 as the hex value. So your black at 35% opaque would be #00000059 (or #59000000 for ARGB).