Enter red, green, blue, and an alpha value (0–1) and get the equivalent 8-digit hex code (#RRGGBBAA) instantly, with a live colour swatch. This lets you express a semi-transparent colour as a single hex string for CSS.
How it works
The three colour channels are each converted to a two-digit hex pair exactly like a normal RGB-to-hex conversion. The alpha value, given from 0 (transparent) to 1 (opaque), is multiplied by 255, rounded, and written as its own two-digit hex pair appended to the end. The result is #RRGGBBAA, where the final pair carries the opacity. Channel values are clamped to 0–255 and alpha to 0–1.
Example
Convert rgba(255, 0, 0, 0.5):
- 255 →
ff, 0 →00, 0 →00 - alpha 0.5 → 0.5 × 255 = 128 →
80 - Result:
#ff000080(a half-transparent red)
| Alpha (0–1) | Hex pair | Meaning |
|---|---|---|
| 0 | 00 | Fully transparent |
| 0.25 | 40 | 25% opaque |
| 0.5 | 80 | 50% opaque |
| 1 | ff | Fully opaque |
The whole conversion runs in your browser — nothing is uploaded.