Something wrong with this tool?

About RGBA To HEX Converter Online

This tool converts RGBA color values to 8-digit hex notation with alpha. rgba(255, 87, 51, 0.5) becomes #FF573380, where the last two characters encode the 50% alpha. Modern CSS supports both formats; sometimes you need the compact hex form.

8-digit hex codes are useful in design tokens, theme files, and CSS variables where you want a single string to fully describe a color including its opacity. They're also necessary when copying colors into apps that only accept hex.

The conversion is exact for alpha values that round cleanly to 8-bit (multiples of 1/255). Slight rounding can occur for arbitrary opacity values like 0.123 — the resulting hex will display as the closest representable alpha.

How to use this tool

How to convert RGBA to a hex color (with alpha)

  1. Two ways to enter the colour

    Type/paste an RGBA string into "RGBA code" (e.g. `rgba(255,128,0,0.5)` or four numbers `200 180 90 0.25`), or set the R/G/B sliders plus the Alpha number. A non-empty "RGBA code" field overrides the sliders.

  2. Accepted RGBA string formats

    The parser handles `rgba(r, g, b, a)`, `rgb(r, g, b)` (alpha defaults to 1), and bare whitespace-separated tuples like `255 128 0 0.5`. Alpha can be a 0–1 float; opacity-percent strings are not parsed.

  3. Press Run

    Output returns `r`, `g`, `b` (0–255), `a` (0–1), `alphaByte` (0–255), `hex` (8-digit `#rrggbbaa`), `hexRgb` (6-digit without alpha), and `rgbaCss` (the ready-to-paste `rgba(r, g, b, a)` string).

  4. Alpha must stay 0–1

    Slider mode validates alpha as a number between 0 and 1 inclusive — anything else throws "Alpha must be a number from 0 to 1." Convert from 0–100 % first if you only have a percentage.