HEX to RGB Converter
Convert HEX color codes to RGB values instantly in your browser.
Convert any HEX color code to RGB instantly with this free online HEX to RGB converter. Type a hex value such as #4f46e5 (or pick a color with the swatch) and get the matching rgb() string and raw R, G, B values right away. It supports 3-digit shorthand, full 6-digit hex, and 8-digit hex with alpha — and everything runs in your browser with nothing to install.
What is a HEX to RGB converter?
A HEX to RGB converter turns a hexadecimal color code into its red, green, and blue components. Hex codes like #4f46e5 are compact and common in CSS and design tools, while RGB values (0–255 per channel) are easier to read, tweak, and use with rgb() and rgba() functions. This tool reads any valid hex code and shows you the exact RGB triplet behind it.
How to convert HEX to RGB
Each pair of hex digits maps to one color channel: the first two are red, the next two green, and the last two blue. Each pair is a base-16 number from 00 to ff, equal to 0–255 in decimal. For example, in #4f46e5, 4f is 79 (red), 46 is 70 (green), and e5 is 229 (blue), giving rgb(79, 70, 229). Shorthand like #f0c is expanded to #ff00cc first.
- Type or paste a HEX color code into the HEX field (the # is optional).
- Read the rgb() string and the raw R, G, B values, updated as you type.
- Use the color picker if you'd rather choose a color visually.
- Click Copy to copy the format you need.
Why use this HEX to RGB converter?
- 100% free with no ads, sign-up, or limits.
- Instant conversion as you type.
- Supports 3-digit shorthand, 6-digit, and 8-digit hex with alpha.
- Copy either the rgb() string or the raw R, G, B numbers.
- Runs entirely in your browser — your colors never leave your device.
Frequently asked questions
How do I convert a HEX color to RGB?
Split the six hex digits into three pairs (red, green, blue) and convert each pair from base-16 to a decimal number between 0 and 255. For example #4f46e5 becomes rgb(79, 70, 229). This tool does the math automatically.
Does it support shorthand hex like #f0c?
Yes. Three-digit shorthand is expanded by doubling each digit, so #f0c is treated as #ff00cc, which is rgb(255, 0, 204).
Can it convert hex with transparency (alpha)?
Yes. If you enter an 8-digit hex code like #4f46e5cc, the last pair is read as the alpha channel and the result is shown as an rgba() value with the alpha between 0 and 1.
Do I need the # symbol?
No. You can paste a hex code with or without the leading #; both 4f46e5 and #4f46e5 work.