ColorToolkits
Format Converter

RGBA to Hex Converter

Convert CSS rgba(r, g, b, a) strings with transparency into 6-digit or 8-digit CSS Color Level 4 hex codes.

Converted (HEX8 (Alpha))
#2563ebcc
#2563EB
Try presets:

How to Use This Tool

  1. Enter or paste your RGBA value or choose one of the curated preset swatches.
  2. Copy the formatted HEX8 (Alpha) value directly, or inspect the secondary HEX, RGB, HSL, and OKLCH chips below.
  3. Click into Tailwind Scale Generator or Contrast Checker to validate accessibility on the converted shade.

Key Features

  • Bidirectional parsing supporting CSS Color Level 4 syntax cleanly
  • Multiplying CSS alpha (0.0 to 1.0) by 255 and converting to zero-padded hexadecimal produces the trailing alpha byte inside #RRGGBBAA.
  • Instant clipboard feedback with live OKLCH and Display-P3 gamut safety
  • Zero server round-trips—every calculation executes immediately in browser memory

Encoding Opacity Alpha [0–1] into Byte AA

Multiplying CSS alpha (0.0 to 1.0) by 255 and converting to zero-padded hexadecimal produces the trailing alpha byte inside #RRGGBBAA.

Reference Snippet (JavaScript)

const rgbaToHex8 = (r, g, b, a) =>
  '#' + [r, g, b, Math.round(a * 255)].map((n) => n.toString(16).padStart(2, '0')).join('');

Frequently Asked Questions

More Color Tools

View all tools →