RGBA to HEX Converter
Convert a CSS rgba()/rgb() color to a HEX code — 6-digit when opaque, 8-digit (#RRGGBBAA) when it has transparency — with a full breakdown of red, green, blue, alpha and HSLA.
Input
Accepts rgba(r, g, b, a), rgb(r, g, b), the modern rgb(r g b / a) syntax, or bare channel values. Alpha may be a 0-1 decimal or a percentage.
Optional. A value from 0 (transparent) to 1 (opaque). Overrides the color's own alpha.
Output
| Property | Value |
|---|---|
| No data yet | |
Guides
Turn any CSS rgba() or rgb() color into a HEX code in one step. Paste the color, and this converter gives you the hex value — 6-digit when the color is opaque, 8-digit (#RRGGBBAA) when it carries transparency — plus a breakdown of the red, green, blue and alpha components and the equivalent hsla() notation. It runs entirely in your browser, so your colors never leave your machine.
How to use it
- Type or paste a color into the RGBA Color field.
- Read the converted HEX value, or copy it with one click.
- Check the Color Values table for the individual channel numbers plus the
rgb(),rgba()andhsla()equivalents.
Need the opposite direction? Use the HEX to RGBA converter — the two are exact inverses, so a color round-trips cleanly between them.
Which formats are accepted?
rgba(255, 0, 0, 0.5)— the classic comma-separated form with alpha.rgb(255, 0, 0)— no alpha channel, treated as fully opaque.rgb(0 170 255 / 50%)— the modern space-separated syntax with a slash before alpha.255, 0, 0, 0.5— bare channel values, no function wrapper.
Channels may be plain numbers (0–255) or percentages, and alpha may be a 0–1 decimal or a percentage. Out-of-range channels are clamped rather than rejected.
When do I get 6 digits and when do I get 8?
Alpha in an 8-digit hex is stored as a byte from 00 (transparent) to FF (opaque). If your color is fully opaque — alpha of exactly 1 — there is nothing for that byte to say, so the converter returns the shorter, more portable 6-digit hex. As soon as alpha drops below 1, the alpha byte is appended: rgba(255, 0, 0, 0.15) becomes #FF000026, because 0.15 × 255 ≈ 38 = 0x26.
That rule is what makes the conversion reversible. #FF0000 → rgba(255, 0, 0, 1) → #FF0000 gets you back exactly where you started, rather than drifting to #FF0000FF.
Do all browsers support 8-digit hex?
Yes — #RRGGBBAA is supported in every current browser. Very old browsers (IE and legacy Edge) do not understand it, so for maximum compatibility use the rgba() row from the results table instead of the 8-digit hex.
Can I change the transparency while converting?
Yes. The optional Alpha Override field forces an alpha between 0 and 1, replacing whatever the input color specifies. It is the quickest way to take an opaque brand color like rgb(51, 102, 153) and get its 50% translucent hex, #33669980.
Is my data private?
Yes. The conversion is plain arithmetic performed locally in your browser — nothing is uploaded to a server.