Adding transparency to a hex colour trips a lot of people up because hex has no
obvious “opacity” field. The answer is the 8-digit hex (#RRGGBBAA), where
the final pair is an alpha byte. This tool converts between an opacity
percentage and that alpha byte, and shows the equivalent rgba().
Percentage to alpha byte
alphaByte = round(opacity% / 100 × 255) -> two-character hex
| Opacity | Alpha byte | 8-digit hex example |
|---|---|---|
| 100% | FF | #6D8BFFFF |
| 75% | BF | #6D8BFFBF |
| 50% | 80 | #6D8BFF80 |
| 25% | 40 | #6D8BFF40 |
| 0% | 00 | #6D8BFF00 |
Both directions
- Colour + opacity → code: pick a base colour and a percentage to get the
8-digit hex, the
rgba()string, and the raw alpha byte. - 8-digit hex → opacity: paste something like
#6D8BFF80and the tool reads the opacity straight back onto the slider.
The preview sits on a checkerboard so you see the true transparency rather than a colour blended against a solid background. Everything runs locally in your browser.