Also available in: Español · Português · Français · العربية
Hex to RGB Converter
Paste any hex code and get the exact RGB values, channel breakdown, and a live swatch.
What is a hex to RGB converter?
A hex code like #4093E6 packs a color into six characters, but plenty of tools — canvas APIs, some design software, older CSS properties, image libraries — want the color spelled out as red, green and blue numbers instead. A hex to RGB converter reads the hex code and unpacks it back into those three channel values, so you get an rgb() string you can drop straight into code that expects one.
It’s built to take whatever hex you’ve actually got, not just the tidy six-digit kind. Paste a 3-digit shorthand like #F80, a standard 6-digit code like #4093E6, or an 8-digit code with alpha like #4093E680 — with or without the leading # — and it returns the matching rgb() value, the individual R, G and B numbers, a swatch you can check by eye, and the same color as hsl() and a named-color match, all without touching the original hex.
How to convert hex to RGB
- Paste in the hex code. Any common form works: 3-digit shorthand (#F80), 6-digit (#4093E6), or 8-digit with alpha (#4093E680), and you can leave the # off entirely if you’re copying from somewhere that doesn’t include it.
- Check the result. The rgb() string appears large with a live color swatch next to it, so you can confirm at a glance that it’s the shade you expected before you use it.
- Copy what you need. A one-click copy button sits next to the rgb() value, and the individual Red, Green and Blue channel numbers are broken out underneath, alongside the same color as hsl(), a nearest-named-color chip linking to that color’s shade page, and a link to the full color picker.
How the conversion works
A hex code is RGB written in base 16 instead of base 10. Each pair of hex digits — 00 through FF — is the same as a number from 0 to 255; converting hex to RGB is just reading each pair back out in decimal, so 40 becomes 64, 93 becomes 147, and E6 becomes 230. Nothing is estimated or smoothed over in that step, which is why going hex to RGB and back gives you the identical color every time. RGB and hex both describe standard sRGB colors, too — a wide-gamut hex from a Display P3 export doesn’t really exist, since that color space is written with a function like color(display-p3 ...) instead.
Two things are worth flagging. The 3-digit shorthand only works because each digit gets doubled — #F80 is shorthand for #FF8800 — which means only the roughly 4,096 colors whose channel pairs happen to repeat can be written that way; the other 16.7 million need the full 6 digits. And if you’re converting an 8-digit hex with an alpha channel, that opacity was already rounded to the nearest 256th when the hex was written — 80 in hex is 128 out of 255, not an exact 0.5 — so the RGB alpha you get back inherits that same small rounding rather than adding any of its own.
Why is it free?
Everything happens locally in your browser, so the hex codes you paste in never get sent anywhere. There’s no sign-up wall before you can see the RGB values, no watermark stamped on the result, and no paid tier unlocking the copy buttons or the extra formats. It’s a basic lookup, and it should just be free.