RGBA to Hex Converter

Convert RGBA colour with alpha into an 8-digit hex code.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

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 pairMeaning
000Fully transparent
0.254025% opaque
0.58050% opaque
1ffFully opaque

The whole conversion runs in your browser — nothing is uploaded.

Ad placeholder (rectangle)