RGBA to HEX converter
Convert rgba() to an 8-digit hex code with the alpha channel preserved, plus the flat hex you would get by compositing onto a background.
- Runs in your browser
- Nothing you enter is sent
- Free, no account
Three channels plus an alpha between 0 and 1.
Converted from RGBA.
Contrast on white
5.17:1
AA for body text
Contrast on black
4.06:1
AA for large text only
| Format | Value | Copy |
|---|---|---|
| HEX | #2563eb | |
| HEX with alpha | #2563ebff | |
| RGB | rgb(37, 99, 235) | |
| RGBA | rgba(37, 99, 235, 1) | |
| RGB (space syntax) | rgb(37 99 235) | |
| HSL | hsl(221.2, 83.2%, 53.3%) | |
| HSLA | hsla(221.2, 83.2%, 53.3%, 1) | |
| HSL (space syntax) | hsl(221.2 83.2% 53.3%) | |
| HSV / HSB | hsv(221.2, 84.3%, 92.2%) | |
| CMYK | cmyk(84.3%, 57.9%, 0%, 7.8%) | |
| Android ARGB | #FF2563EB | |
| SwiftUI | Color(red: 0.145, green: 0.388, blue: 0.922) | |
| Nearest CSS name | royalblue (closest match) |
CSS custom properties
--color: #2563eb; --color-rgb: 37 99 235; --color-hsl: 221.2 83.2% 53.3%;
Your colour values never leaves this tab — check it yourself—
Starting the network probe…
The counter above wraps fetch, XMLHttpRequest and navigator.sendBeacon in this tab and counts every call. It does not block anything — it just reports.
Two ways to verify independently
- Turn off Wi-Fi or enable airplane mode, then use the tool. It keeps working, because the page is already fully loaded.
- Open your browser devtools, switch to the Network tab, clear it, and run the tool. No new row appears.
Why this matters
In 2025 researchers found that popular online formatters had retained tens of thousands of user-submitted snippets — JSONFormatter.org and CodeBeautify together exposed roughly 80,000 saved documents, many containing live cloud credentials, private keys and internal database connection strings, because “format this” quietly meant “upload this”. A separate incident exposed roughly 3.5 million user PDFs on a document-conversion service. The only structural fix is not sending the data in the first place: this site is served under a Content-Security-Policy whose connect-src contains no third-party origin, so a request off this device cannot be made even by accident.
Alpha as a fourth hex pair
An eight-digit hex code is #RRGGBBAA: the familiar three channels, then opacity as a
byte. The alpha conversion is multiply by 255 and round.
| Alpha (0–1) | Percent | Hex |
|---|---|---|
| 0 | 0% | 00 |
| 0.05 | 5% | 0d |
| 0.1 | 10% | 1a |
| 0.2 | 20% | 33 |
| 0.25 | 25% | 40 |
| 0.5 | 50% | 80 |
| 0.6 | 60% | 99 |
| 0.75 | 75% | bf |
| 0.9 | 90% | e6 |
| 1 | 100% | ff |
Four-digit shorthand #RGBA works the same way three-digit does, by doubling each digit
— so #f008 is #ff000088.
Alpha is an instruction, not a colour
This is the thing that trips people up. rgba(0, 0, 0, 0.5) is not a specific grey — it
is “blend black with whatever is behind me, half and half”. On white it renders as
#808080; on a dark surface it renders as near-black. That is exactly what you want for
an overlay or a shadow, and exactly what you do not want for a token that has to look identical
everywhere.
If you need one fixed colour, composite it yourself. Over a known background the maths is a linear blend per channel:
result = foreground × alpha + background × (1 - alpha)
rgba(37, 99, 235, 0.2) over #ffffff:
r = 37 × 0.2 + 255 × 0.8 = 211
g = 99 × 0.2 + 255 × 0.8 = 224
b = 235 × 0.2 + 255 × 0.8 = 251
#d3e0fb — an opaque colour that looks the same on any background Where 8-digit hex is worth using
- Design tokens. One string carries the whole value, so a token file stays a flat map of names to strings.
- Handing values to a designer. Figma accepts and displays eight-digit hex directly.
- Shadows and borders.
box-shadow: 0 1px 2px #0000000fis more compact than thergba()form and easier to scan in a list of shadows.
Where it is not worth it: anywhere a human has to reason about the opacity. rgba(0, 0, 0, 0.06)
says “6%” out loud; #0000000f does not.
Browser support
Eight-digit hex has been supported in every major browser since 2016 and there is no practical
reason to avoid it today. If you are supporting a very old embedded webview or an email client,
use rgba(), which is universally understood — the two express exactly the same colour.
Questions
How is alpha written in hex?
As a fourth pair of digits appended to the six: `#RRGGBBAA`. An alpha of 1 is `ff`, 0.5 is `80`, 0 is `00`. Four-digit shorthand `#RGBA` works the same way as three-digit shorthand does for opaque colours.
Is 8-digit hex safe to use?
Yes in every current browser. If you need to support something very old, use `rgba()`, which has been supported far longer and expresses exactly the same colour.
Why does my semi-transparent colour look different over a dark background?
Because alpha is not a colour, it is a blend instruction. `rgba(0, 0, 0, 0.5)` is grey on white and near-black on dark grey. If you need one fixed colour that looks the same everywhere, composite it against your actual background and use the resulting opaque hex.
How do I convert a percentage opacity?
Divide by 100 to get the 0–1 alpha, then multiply by 255 and convert to hex — or just type the percentage into the slider on this page and read the eight-digit value off the table.