Tools
EN

Hex to RGB Converter

Enter a hex color code such as #7C3AED to get its RGB values instantly. Shorthand codes like #F80, 8-digit codes with transparency and codes without the # all work – or pick a color visually.

RGB values

All color formats

HEX
RGB
RGBA
HSL
HSV
CMYK
CSS name

How it is calculated

Private: your data is processed in your browser and never uploaded.

How to convert hex to RGB

  1. Type or paste a hex color code into the Hex color code field, with or without #, or click the swatch to pick a color.
  2. Read the result as rgb() and see the red, green and blue values on the sliders, together with HSL, HSV and CMYK.
  3. Copy any format with one click. The formula next to the formats shows how each pair of hex digits becomes a number from 0 to 255.

Hex to RGB formula

A hex color code is three bytes written in hexadecimal: #RRGGBB. Each pair of digits is one channel from 00 (0) to FF (255). To convert a pair, multiply the first digit by 16 and add the second, counting A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15. Example for #7C3AED:

So #7C3AED = rgb(124, 58, 237).

Shorthand and transparent hex codes

A 3-digit code is shorthand in which every digit is doubled: #F80 = #FF8800 = rgb(255, 136, 0). An 8-digit code adds an alpha byte for opacity: in #7C3AED80 the last pair 80 = 128, and 128 ÷ 255 ≈ 0.5, so it equals rgba(124, 58, 237, 0.5). The 4-digit form #RGBA works the same way.

Common hex color codes and their RGB values

ColorHexRGB
White#FFFFFFrgb(255, 255, 255)
Black#000000rgb(0, 0, 0)
Red#FF0000rgb(255, 0, 0)
Lime#00FF00rgb(0, 255, 0)
Blue#0000FFrgb(0, 0, 255)
Yellow#FFFF00rgb(255, 255, 0)
Orange#FFA500rgb(255, 165, 0)
Gray#808080rgb(128, 128, 128)
Navy#000080rgb(0, 0, 128)
Purple#800080rgb(128, 0, 128)
Teal#008080rgb(0, 128, 128)

Frequently asked questions

How do I convert hex to RGB by hand?

Split the code into three pairs and convert each pair from hexadecimal: first digit × 16 + second digit. For #1E90FF: 1E = 30, 90 = 144 and FF = 255, so the color is rgb(30, 144, 255).

What does a 3-digit hex color like #F80 mean?

It is shorthand for a 6-digit code with every digit doubled: #F80 = #FF8800 = rgb(255, 136, 0). Only colors whose pairs have two equal digits can be shortened.

How do I convert hex to RGB in JavaScript or Python?

JavaScript: [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16)) for a code like #RRGGBB. Python: tuple(int(h[i:i + 2], 16) for i in (1, 3, 5)). In CSS no conversion is needed – both notations are accepted.

Is hex or RGB better for CSS?

They describe exactly the same colors. Hex is shorter and common in design tools; rgb() is easier to read and adjust and makes transparency obvious with rgba(). Modern browsers also accept 8-digit hex codes with alpha.