HEX to RGB

Paste any HEX color and get the matching RGB, RGBA and CSS values instantly.

HEX
#4F46E5
RGB
rgb(79, 70, 229)
RGBA
rgba(79, 70, 229, 1)
HSL
hsl(243, 75%, 59%)
HSV
hsv(243, 69%, 90%)
CMYK
cmyk(66%, 69%, 0%, 10%)
CSS Variable
--color-primary: #4F46E5;

About the hex to rgb

HEX is the most common color format on the web — six hexadecimal digits like #4F46E5 that pack the red, green and blue channels into a compact string. RGB expresses the same channels as decimal numbers from 0 to 255, which is easier to manipulate programmatically and is required for rgba() when you need transparency.

To convert, split the HEX string into pairs and parse each pair as a base-16 number. For example, #4F46E5 becomes rgb(79, 70, 229).

Frequently asked questions

What is a HEX color?+

A HEX color is a six-digit hexadecimal representation of a color, prefixed with #. Each pair of digits encodes the red, green and blue channels respectively, from 00 to FF.

How do I convert HEX to RGB?+

Split the HEX value into three pairs and convert each pair from base 16 to base 10. The result is a value between 0 and 255 for red, green and blue.

What is the difference between HEX and RGB?+

They describe the same color, just in different notations. HEX is more compact and common in CSS files; RGB is easier to read and manipulate programmatically and supports alpha via rgba().

Can I use RGB in CSS?+

Yes. Modern CSS supports both rgb() and rgba(). You can also use the new space-separated syntax: rgb(79 70 229 / 0.5).

Related tools