🎨 RGBA to HEX Converter
By ToolNimba Color Team · Updated 2026-06-19
Swatch over a checkerboard
Edit any field. Enter RGBA values or an 8-digit hex and the rest update live.
This converter turns an RGBA color into an 8-digit hex code and back again. Enter red, green and blue from 0 to 255 plus an alpha from 0 (fully transparent) to 1 (fully opaque), and you get the #RRGGBBAA hex, the plain 6-digit #RRGGBB, and the alpha on its own as a two-character hex. A swatch sits over a checkerboard so you can actually see how transparent the color is. Paste an existing 8-digit hex into the hex field and it splits back out into rgb and alpha for you.
What is the RGBA to HEX Converter?
An RGBA color describes a pixel with four numbers: how much red, green and blue light it emits (each 0 to 255) and an alpha value that says how opaque it is. Alpha runs from 0 to 1 in CSS, where 0 means you see straight through to whatever is behind, and 1 means the color is solid. The familiar 6-digit hex code (#RRGGBB) can only store the three color channels, so for years there was no way to write transparency directly in a hex string.
The 8-digit hex notation, often called hex8, fixes that by adding a fourth pair of hex digits for alpha: #RRGGBBAA. Each pair is a single byte written in base 16, from 00 to FF (0 to 255 in decimal). The conversion is the same for every channel: take the 0 to 255 value, divide by 16 to get the first hex digit and use the remainder for the second. Alpha is the only channel that needs an extra step, because CSS alpha is a 0 to 1 fraction. You scale it to a byte first by multiplying by 255 and rounding, so 0.5 becomes 128, which is 80 in hex.
Because alpha is squeezed into 256 steps, the round trip is not always perfectly exact. An alpha of 0.5 stored as 80 hex reads back as 128 over 255, which is 0.5019..., usually rounded to 0.50 for display. This is harmless for screen colors but worth knowing if you compare a hex8 value against the original fraction. Modern browsers support #RRGGBBAA in CSS, so you can drop the converted code straight into a stylesheet without writing a separate rgba() rule.
When to use it
- Saving a semi-transparent CSS color as a single 8-digit hex token in a design system or theme file.
- Converting an rgba() value from a design tool into the #RRGGBBAA syntax some frameworks and configs expect.
- Reading an unfamiliar 8-digit hex back into rgb and an alpha you can reason about.
- Pulling the alpha out of a color as its own AA hex byte to reuse on other shades.
How to use the RGBA to HEX Converter
- Enter the red, green and blue channels (each 0 to 255) and the alpha (0 to 1).
- Read the 8-digit hex (#RRGGBBAA), the 6-digit hex, and the alpha byte as hex.
- To go the other way, type or paste an 8-digit (or 6-digit) hex into the hex field.
- Check the swatch over the checkerboard to judge the transparency, then copy the #RRGGBBAA code.
Formula & method
Worked examples
Convert rgba(51, 123, 255, 0.5) to an 8-digit hex.
- Red 51 in hex = 33
- Green 123 in hex = 7B
- Blue 255 in hex = FF
- Alpha byte = round(0.5 x 255) = round(127.5) = 128, and 128 in hex = 80
- Join the pairs: 33 7B FF 80
Result: #337BFF80 (6-digit #337BFF, alpha byte 80)
Convert the 8-digit hex #FF5733CC back to RGBA.
- Split into pairs: FF, 57, 33, CC
- FF = 255 (red), 57 = 87 (green), 33 = 51 (blue)
- Alpha pair CC = 204, so alpha = 204 / 255 = 0.8
- Assemble the rgba() value
Result: rgba(255, 87, 51, 0.8)
Common CSS alpha values and their hex (AA) byte
| Alpha (0 to 1) | Byte (alpha x 255) | Hex AA |
|---|---|---|
| 1.00 | 255 | FF |
| 0.90 | 230 | E6 |
| 0.75 | 191 | BF |
| 0.50 | 128 | 80 |
| 0.25 | 64 | 40 |
| 0.10 | 26 | 1A |
| 0.00 | 0 | 00 |
Common mistakes to avoid
- Writing the alpha pair before the color, not after. The CSS standard order is #RRGGBBAA, with alpha last. Some other systems use #AARRGGBB (alpha first), so a value that looks right can render with the wrong opacity if you mix the two conventions.
- Treating alpha like a 0 to 255 channel. CSS alpha is a 0 to 1 fraction, not a 0 to 255 byte. You must multiply by 255 before converting to hex. Putting 0.5 straight into a hex pair gives nonsense.
- Expecting an exact round trip. Alpha only has 256 possible hex steps, so 0.5 stores as 80 and reads back as 0.5019..., which displays as 0.50. Small fractions can drift by a hair after a round trip.
- Assuming every browser reads 8-digit hex. Hex8 is well supported in current browsers, but very old ones ignore it. If you must support legacy targets, keep an rgba() fallback alongside the #RRGGBBAA value.
Glossary
- RGBA
- A color model with red, green and blue channels (0 to 255 each) plus an alpha channel for opacity (0 to 1).
- Alpha
- The opacity of a color, from 0 (fully transparent) to 1 (fully opaque). It does not change the color itself, only how much shows through.
- Hex8 (#RRGGBBAA)
- An 8-digit hexadecimal color code where the last two digits encode the alpha as a byte from 00 to FF.
- Byte
- A value from 0 to 255, written as two hexadecimal digits (00 to FF). Each color channel and the alpha use one byte.
- Hexadecimal
- A base-16 number system using digits 0 to 9 and letters A to F, the standard way to write color values on the web.
Frequently asked questions
How do I convert RGBA to hex?
Write each of red, green and blue as a two-digit hex pair (0 to 255 becomes 00 to FF), then multiply the alpha by 255, round it, and write that byte as a final pair. The result is #RRGGBBAA. This tool does it instantly as you type.
What is an 8-digit hex color?
An 8-digit hex (hex8) is a color code in the form #RRGGBBAA. The first six digits are the usual red, green and blue, and the last two digits are the alpha (opacity) written as a hex byte from 00 to FF.
How is alpha 0.5 written in hex?
Multiply 0.5 by 255 to get 127.5, round to 128, then convert 128 to hex, which is 80. So an alpha of 0.5 becomes the hex pair 80, giving a code like #337BFF80.
Can I convert an 8-digit hex back to RGBA?
Yes, this converter is two-way. Paste a #RRGGBBAA value into the hex field and it splits into rgb (0 to 255) and an alpha (0 to 1), where the alpha is the last pair divided by 255.
Do browsers support #RRGGBBAA hex?
All modern browsers support 8-digit hex in CSS, so you can use #RRGGBBAA directly. For very old browsers, keep an rgba() rule as a fallback since they ignore the alpha digits.
Why does my alpha change slightly after converting?
Alpha is stored in only 256 hex steps, so a fraction like 0.5 becomes the byte 128 (80 hex) and reads back as 0.5019..., shown as 0.50. The tiny drift is normal and invisible on screen.