Skip to main content

Convert HEX to RGB, Free

Files convert instantly in your browser. 100% private, any file size, no account needed.

100% private No signup Unlimited size No upload

How to convert HEX to RGB

Hexadecimal color codes are a compact way to write RGB colors in CSS and HTML. A code like #3A8FC2 encodes three byte values in hex: the first two digits are red (3A = 58), the middle two are green (8F = 143), and the last two are blue (C2 = 194). To convert hex to RGB, split the six-character code into three pairs and convert each pair from base-16 to base-10. This runs instantly in your browser as a pure JavaScript calculation.

Knowing the RGB values behind a hex color is useful when working with CSS color functions (rgb(), rgba()), graphics APIs, CSS animations, or tools that accept RGB input. It is also helpful for understanding the color: R=58, G=143, B=194 tells you immediately that the blue channel dominates, producing a medium-bright blue. The conversion works in both directions; RGB to hex is simply the reverse: convert each decimal 0-255 to a zero-padded two-digit hex pair.

Enter the hex color code

Type a 6-digit hex code with or without the # prefix (e.g., #3A8FC2 or 3A8FC2). Three-digit shorthand (#RGB) is also accepted.

See the RGB values

The three decimal components (0-255 each) appear instantly: R, G, and B.

View the color preview

A swatch shows the actual color so you can confirm you entered the right code.

Copy in your preferred format

Copy as rgb(58, 143, 194) for CSS, or as three separate values for graphics software or code parameters.

Frequently asked questions

How does hex to RGB conversion work?

Split the 6-digit hex code into three 2-digit pairs. Convert each pair from base-16 to base-10. For #3A8FC2: 3A=58 (red), 8F=143 (green), C2=194 (blue).

What does the 3-digit hex shorthand mean?

A 3-digit code like #F3A expands to #FF33AA by doubling each digit. It is a shorthand only valid when both digits of each pair are identical.

What is the hex code for pure red, green, and blue?

Pure red is #FF0000 (R=255, G=0, B=0). Pure green is #00FF00. Pure blue is #0000FF.

Can I add an alpha (transparency) channel?

Hex supports 8-digit RGBA codes: #RRGGBBAA. The last two digits specify opacity, where FF = fully opaque and 00 = fully transparent. CSS also accepts rgba(R, G, B, alpha) where alpha is 0.0 to 1.0.

Are hex color codes case-sensitive?

No. #3a8fc2 and #3A8FC2 are identical. CSS accepts both, and most tools normalize to one case.