utility

HEX to RGB & RGBA Color Converter

Convert hexadecimal color codes (#RRGGBB and #RGB shorthand) into `rgb(r, g, b)`, `rgba(r, g, b, a)`, `hsl(h, s%, l%)`, and CMYK formats. Includes interactive color swatch and alpha transparency slider.

⚡ Quick Answer

To convert HEX to RGB, take the two hexadecimal digits for each channel (RR, GG, BB) and convert to base 10 integers (0-255). For example, #FF0000 = rgb(255, 0, 0).

💡 How It Works

Parses the hex string into 8-bit integers using `parseInt(hexSubstring, 16)`.

📖 How to Use HEX to RGB Converter

  1. Enter or paste any HEX color code (e.g. `#6366f1`).
  2. Adjust alpha opacity if you need RGBA with transparency.
  3. Copy your preferred format (RGB, RGBA, HSL, CMYK).

✨ Key Features

  • Supports 3-digit shorthand (#fff) and 6-digit (#ffffff) HEX
  • 8-digit hex with alpha support (#6366f1aa)
  • Live visual color preview box
  • 1-click copy for all CSS color formats

❓ Frequently Asked Questions

What is 8-digit HEX code?

8-digit HEX (#RRGGBBAA) includes two trailing characters representing the alpha transparency channel (e.g. `#00000080` is 50% transparent black).