Answer

How to convert a HEX color to RGB

Convert a hex color code to RGB (and HSL, HSV) instantly in your browser, with a live preview.

A hex color packs red, green, and blue into three pairs of hex digits: #RRGGBB. To convert to RGB, read each pair as a 0–255 value — for example, #4f46e5 is rgb(79, 70, 229), because 4f=79, 46=70, and e5=229.

Input
#4f46e5
Output
rgb(79, 70, 229)

Each hex pair is base-16: 4f = 4×16+15 = 79, e5 = 14×16+5 = 229.

Open the Color Converter → Free · runs in your browser · nothing uploaded

Steps

  1. Open the Color tool and paste your hex value (with or without the leading #).
  2. Read the RGB value, plus HSL, HSV, and CMYK alongside a live colour preview.
  3. Enter an rgb(...) value to convert the other way.
  4. Shorthand hex like #abc is expanded to #aabbcc automatically.

Frequently asked questions

How do I convert a 3-digit hex like #abc?
Each digit is doubled: #abc becomes #aabbcc, i.e. rgb(170, 187, 204). The converter expands shorthand hex automatically.
What about alpha / transparency?
An 8-digit hex (#RRGGBBAA) adds an alpha pair, which maps to the fourth value in rgba(r, g, b, a) where a is 0–1.