RGBA to HEX Converter
Convert rgba() color values to hex, including 8-digit hex with alpha. Free and private.
Independently verified for accuracy
Calculator by Toolsloft ↗Enter an r, g, b, a value to convert
Convert an rgba() color into a hex code, folding the alpha channel into an 8-digit hex when you provide one. Enter the red, green, and blue channels plus an optional 0 to 1 alpha. Without an alpha you get a standard 6-digit hex.
How this is calculated
Each channel is written as a two-digit hexadecimal byte. The alpha, given as a 0 to 1 decimal, is multiplied by 255 and rounded to the nearest byte, then appended as the eighth and ninth hex digits when present.
How to use
- Enter the red, green, and blue values, and an alpha from 0 to 1 if you have one.
- The hex code appears below as you type.
- Copy the hex value into your CSS or design tool.
Examples
- 51, 102, 204, 0.5:
#3366cc80 - 255, 0, 0, 1:
#ff0000ff
FAQ
- How is the alpha turned into hex?
- The 0 to 1 alpha is multiplied by 255 and rounded, so 0.5 becomes 128 (80 in hex) and 1 becomes 255 (ff). It is appended as the last two hex digits.
- Do all browsers support 8-digit hex?
- Modern browsers do. If you need to support very old browsers, use the rgba() form instead of 8-digit hex.