What is a HEX to RGB converter and why use it?

A HEX to RGB converter translates a hexadecimal color such as #2563eb into its red, green and blue values, rgb(37, 99, 235). Both describe the same color in different notation.

Design tools usually export hex, but CSS functions, canvas code and transparency effects often need rgb or rgba. Converting by hand means working in base 16, so this tool does it instantly and shows the color so you can confirm it is right.

How to use this tool

  1. Enter a hex code

    Type or paste a color such as #ff5733, or choose one with the color picker. The # is optional.

  2. Check the preview

    The swatch shows the color. A red message appears if the code is not valid.

  3. Copy the RGB value

    Press Copy RGB for the full rgb() string, or Copy values only for the three numbers.

How HEX is converted to RGB

A six-digit hex code is three pairs: red, green and blue. Each pair is a base-16 number from 00 to ff, which equals 0 to 255. For #ff5733: ff = 255, 57 = 87, 33 = 51, giving rgb(255, 87, 51).

Three-digit hex is shorthand where each digit is doubled, so #f80 means #ff8800. Eight-digit hex adds an alpha pair; the tool converts it to a 0 to 1 opacity and returns an rgba() value.

R = hex digits 1–2 → decimalG = hex digits 3–4 → decimalB = hex digits 5–6 → decimal

FAQ

How do I convert hex to RGB?

Split the code into three pairs and convert each from base 16 to decimal. #1e90ff becomes 1e = 30, 90 = 144, ff = 255, so rgb(30, 144, 255).

Does it work without the # symbol?

Yes. Both ff5733 and #ff5733 are accepted.

Does it support 3-digit hex codes?

Yes. #fff is expanded to #ffffff, which is rgb(255, 255, 255).

What about transparency?

Enter an 8-digit code such as #ff573380. The last pair is the alpha channel and the result is returned as rgba().