RGBA to HEX converter
Enter red, green and blue from 0 to 255 and alpha from 0 to 1 to get the 8-digit HEX code and the plain 6-digit code.
Loading the tool…
Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.
How to use it
- Enter red r, green g, blue b and alpha.
- The result appears straight away and updates as you edit.
- Copy the result, or copy a link that keeps the same values to share it.
How it is calculated
Each channel becomes two hex digits; alpha becomes a byte A = round(alpha × 255) appended last: #RRGGBBAA.
Example
Inputs: Red R = 255, Green G = 128, Blue B = 0, Alpha = 0.5 0 to 1. Result: 8-digit HEX code: #FF800080; Alpha byte: 128; Opacity: 50%.
Limits and caveats
- #RRGGBBAA works in modern browsers; Android puts alpha first (#AARRGGBB).
- Alpha is rounded to one of 256 steps, so the third decimal may shift.
Questions about this tool
What do the last two digits of an 8-digit HEX mean?
They are alpha in hexadecimal: FF is fully opaque, 00 fully transparent and 80 about 50%.
How do I write 50% opacity in HEX?
Multiply 0.5 by 255 to get 127.5, round to 128, which is 80 in hex.
Do all browsers support 8-digit HEX?
Current Chrome, Firefox, Safari and Edge support it as part of CSS Color 4. Older software may need rgba() instead.
