Skip to content
Color Tools

HEX to RGB Converter

Type or paste any HEX color code and get the RGB value instantly — with alpha support, live preview and every other CSS format one copy-click away. Free and 100% in your browser.

Accepts #RGB, #RRGGBB and #RRGGBBAA — with or without the #.

Enter a color to see every format.

How HEX to RGB conversion works

A HEX color code is nothing more than three numbers written in hexadecimal (base-16). The six digits after the # split into three pairs — RR, GG, BB — and each pair is the amount of red, green and blue light on a scale from 00 (0) to ff (255). Converting to RGB just means reading each pair as a decimal number.

Take #3564c4: the red pair 35 is 3×16 + 5 = 53, the green pair 64 is 6×16 + 4 = 100, and the blue pair c4 is 12×16 + 4 = 196. The result is rgb(53, 100, 196). The conversion is exact in both directions — HEX and RGB are two spellings of the same 8-bit value, so nothing is rounded and nothing is lost.

Shorthand, case and the missing “#”

Three-digit codes like #f60 are shorthand: each digit is doubled, so #f60 expands to #ff6600rgb(255, 102, 0). Case never matters (#3564C4 and #3564c4 are identical), and this converter also accepts codes pasted without the leading #, because that’s how they often arrive from chat messages and spreadsheets.

Transparency: 8-digit HEX and rgba()

Modern CSS allows a fourth pair for alpha: #3564c480 is the same blue at 50% opacity, because 80 is 128 and 128 ÷ 255 ≈ 0.5. In RGB notation that becomes rgba(53, 100, 196, 0.5). Watch out when copying values between platforms: CSS and most web tools put alpha last (#RRGGBBAA), while Android historically puts it first (#AARRGGBB) — pasting one into the other silently swaps your red channel with transparency.

Common conversions

ColorHEXRGB
White#ffffffrgb(255, 255, 255)
Black#000000rgb(0, 0, 0)
Red#ff0000rgb(255, 0, 0)
Crimson#dc143crgb(220, 20, 60)
Rebecca purple#663399rgb(102, 51, 153)
50% gray#808080rgb(128, 128, 128)

Where you actually need RGB instead of HEX

  • Canvas and WebGL code — pixel APIs hand you raw 0–255 channel numbers, not HEX strings.
  • Alpha in older CSS — before 8-digit HEX had full support, rgba() was the only way to write transparency.
  • Native development — iOS UIColor and many game engines want channels as floats from 0 to 1: divide each RGB value by 255 (53 ÷ 255 ≈ 0.208).
  • Design handoffs — print and brand guidelines often list RGB next to CMYK and Pantone-style references.

Common mistakes to avoid

  • Five- or seven-digit codes are invalid — valid lengths are 3, 4, 6 or 8 digits after the #.
  • Digits must be 0–9 and a–f. A code like #12g45z fails because g and z aren’t hexadecimal.
  • RGB channels cap at 255. If a formula gives you 256 or −1, something upstream clipped or overflowed.
  • Don’t confuse rgb(53, 100, 196) with percentages — rgb(20%, 39%, 77%) is also valid CSS but a different notation of the same idea.

Everything on this page runs locally in your browser — colors you type are never sent to a server. Need the reverse direction? Use the RGB to HEX converter, or the universal color converter for Lab, LCH and OKLCH output.

Frequently asked questions

Is HEX to RGB conversion lossless?

Yes. A 6-digit HEX code and an rgb() value with 0–255 integers encode exactly the same 8-bit color, so converting between them never changes the color at all.

Does letter case matter in HEX codes?

No. #3564C4, #3564c4 and #3564C4 are all the same color. CSS treats hexadecimal digits case-insensitively; lowercase is just the common convention.

How do I convert HEX with transparency?

Use the 8-digit form: the last pair is alpha from 00 (fully transparent) to ff (fully opaque). #3564c480 equals rgba(53, 100, 196, 0.5), because hex 80 is 128 and 128 ÷ 255 is about 0.5.

Why do RGB values only go up to 255?

Each channel is stored in one byte, i.e. 8 bits, which can hold 256 values: 0 through 255. Two hexadecimal digits cover exactly that range — that is why HEX pairs and RGB channels line up perfectly.

What is the formula to convert HEX to RGB by hand?

Split the code into pairs and convert each from base-16: multiply the first digit by 16 and add the second (a=10, b=11 … f=15). For #c4: 12 × 16 + 4 = 196.

Is my color data uploaded anywhere?

No. This converter runs entirely in your browser with no server round-trip — you can even use it offline once the page is loaded.