Hex → rgb()
Hex to RGB Converter
Split a hex color code into its red, green and blue channel values.
What RGB asks that hex does not
Hex states a color. RGB lets you calculate with one. The two carry identical information — three channel values from 0 to 255 — but only one of them is arithmetic you can act on.
Splitting #1A73E8 into pairs gives red 1A, green 73 and
blue E8. Convert each pair out of base 16 and you have
rgb(26, 115, 232): the same color, now in a form you can add opacity to, interpolate
across a gradient, or hand to an image filter.
For the underlying structure — why six digits means three bytes, and where the 16.7 million figure comes from — see how hex color codes work.
Converting a channel by hand
Each pair is a two-digit hex number, so the arithmetic is the same as any hex to decimal conversion: multiply the first digit by 16 and add the second.
#1A73E8 red 1A → 1×16 + 10 = 26 green 73 → 7×16 + 3 = 115 blue E8 → 14×16 + 8 = 232 rgb(26, 115, 232)
The pairs worth memorising
Nine values cover most of what you need to read a color at a glance.
| Hex pair | Decimal | Roughly |
|---|---|---|
| 00 | 0 | None |
| 20 | 32 | 12% |
| 40 | 64 | 25% |
| 66 | 102 | 40% |
| 80 | 128 | 50% |
| 99 | 153 | 60% |
| BF | 191 | 75% |
| CC | 204 | 80% |
| FF | 255 | Full |
The first digit of a pair is roughly the channel strength in sixteenths. C something is about three quarters, 8 something is about half, 2 something is low. That is enough to read a color without converting it.
rgb() notation in CSS
Modern CSS accepts several spellings of the same color. All four of these are identical.
#1A73E8 rgb(26, 115, 232) rgb(26 115 232) ← modern space-separated syntax rgb(26 115 232 / 100%) ← with explicit alpha
The comma-free form is the current standard and allows alpha after a slash. The comma form still works everywhere and is what most tooling still emits.
Why convert hex to RGB at all
Hex is compact and RGB is arithmetic. Anywhere you need to calculate with a color rather than just state it, channel numbers are what you actually need.
- Opacity.
rgba()and color-mixing functions take channel values. - Programmatic colors. Generating a palette, interpolating a gradient or shifting a tint all work on numbers.
- Design tools. Photoshop, Figma and most native pickers think in channels first.
- Image processing. Every pixel operation is arithmetic on channel values.
Frequently asked questions
How do I convert hex to RGB?
Split the six digits into three pairs and convert each pair from hex to decimal. The results are the red, green and blue values from 0 to 255.
What is #FF0000 in RGB?
rgb(255, 0, 0), which is pure red with no green or blue.
What is #1A73E8 in RGB?
rgb(26, 115, 232).
Can I convert a 3-digit hex color?
Yes. Each digit is doubled first, so #1A9 becomes #11AA99, which is rgb(17, 170, 153).
What about the alpha channel?
An 8-digit hex code carries alpha in the last pair. Divide it by 255 to get the 0 to 1 value that rgba() expects.
Is rgb() better than hex?
Neither is better. Hex is more compact for a fixed color; rgb() is easier when you need to calculate with the channels or add opacity.