Developer

HEX to RGB Converter

Convert HEX color codes to RGB and RGBA values with a step-by-step breakdown of the math.

Developer

Why Use the HEX to RGB Converter?

Type any 3, 6 or 8 digit code into this hex to rgb converter and it returns the matching rgb() and rgba() values, the separate red, green and blue numbers, and the math behind them. Each hex pair is broken down step by step, so you can see that 63 means 6 × 16 + 3 = 99 instead of simply trusting a result. Developers get paste-ready CSS, while students and designers learning color codes finally see how hexadecimal maps to decimal.

How to Use the HEX to RGB Converter

  1. Type or paste a HEX code into the input. Shorthand such as #F60, full codes such as #1E90FF and 8-digit codes with transparency such as #1E90FF80 all work.
  2. Read the rgb() result for standard CSS, or the rgba() line when you need an alpha channel; alpha comes from the last two digits of an 8-digit code and is 1 otherwise.
  3. Follow the step-by-step breakdown to see each pair converted to decimal, for example 1E = 1 × 16 + 14 = 30.
  4. Copy the rgb() or rgba() value, or the individual R, G and B numbers, whichever your code, design tool or spreadsheet expects.

Best For

  • Converting HEX brand colors into rgba() so you can add transparency to overlays, shadows and tinted backgrounds.
  • Entering separate R, G and B numbers into software that asks for each channel individually, such as LED controllers or game engines.
  • Learning or teaching hexadecimal by checking answers against the worked breakdown for each pair.
  • Decoding 8-digit HEX values exported from design tools to find out what opacity they actually contain.

Pro Tip

Memorizing a few anchor pairs makes HEX readable at a glance: 00 is 0, 33 is 51, 66 is 102, 80 is 128, 99 is 153, CC is 204 and FF is 255. With those in mind you can tell that #CC3333 is a medium-strength red without converting anything. When you need transparency in modern CSS, you can also write the channels as rgb(204 51 51 / 50%), the space-separated syntax that all current browsers support.

FAQ

HEX to RGB Converter FAQ

How do I convert HEX to RGB?

Split the six digits into three pairs for red, green and blue. For each pair, multiply the first digit by 16 and add the second, counting A to F as 10 to 15. For #1E90FF that gives 1 × 16 + 14 = 30, 9 × 16 + 0 = 144 and 15 × 16 + 15 = 255, so the result is rgb(30, 144, 255).

What does an 8-digit HEX code mean?

An 8-digit code adds a fourth pair for alpha, written #RRGGBBAA. The alpha pair converts like the others and is then divided by 255, so FF is fully opaque (1), 00 is fully transparent (0) and 80 is 128 / 255, about 0.5. This converter shows that value in its rgba() output.

How do 3-digit HEX codes work?

A 3-digit code is shorthand in which each digit is doubled, so #F60 expands to #FF6600, which is rgb(255, 102, 0). Shorthand only exists for colors whose pairs are made of two identical digits, so most colors need the full six digits.

Does converting HEX to RGB change the color?

No. Both notations describe exactly the same 8-bit sRGB channel values, with 256 levels per channel, so the conversion is lossless. Choose whichever fits the context: HEX is compact for design handoff, while rgb() and rgba() read more clearly when you are adjusting channels or opacity in code.

Learn more

Guides for the HEX to RGB Converter

How to Convert HEX to RGB (and RGB to HEX) Step by Step

Learn how to convert HEX to RGB and back by hand with worked examples, the RGB to HEX formula, shorthand and 8-digit codes, plus copy-ready JavaScript.

Read Guide

HEX Color Opacity: 8-Digit HEX, RGBA and a Full Transparency Table

Learn how HEX opacity works with 8-digit HEX codes, get a full transparency table from 100% to 0%, and know when to use #RRGGBBAA, rgba() or opacity.

Read Guide

RGB vs CMYK: Why Your Colors Look Different in Print

RGB vs CMYK explained: why screen colors shift in print, what gamut means, why quick RGB to CMYK formulas are only estimates, and a print-safe color workflow.

Read Guide
Copied