HEX to RGB Converter
Convert HEX color codes to RGB values instantly in your browser. Paste a hex code and get the red, green and blue channels — free and private.
HEX
—
RGB
—
HSL
—
How to convert HEX to RGB
- Type or paste a hex color code into the box above (with or without the #).
- The RGB, and HSL values update live as you type.
- Use the color picker next to the input to pick a color visually instead.
How the conversion works
A hex color packs three channels — red, green and blue — into a single base-16 string. Each pair of hex digits (00–ff) maps to a decimal value from 0–255, so #3b82f6 becomes rgb(59, 130, 246). Shorthand 3-digit codes like #fff are expanded by duplicating each digit before the same math applies.
Where you'll need this
- Reading a hex value out of a design tool or brand guide and needing the RGB equivalent for a canvas, SVG or image-processing API.
- Porting CSS colors into a language or library that expects RGB tuples instead of hex strings.
- Debugging a color discrepancy between two systems that report colors differently.
Related tools
- RGB to HEX converter — go the other way.
- HEX to HSL converter — get hue, saturation and lightness instead.
- Color contrast checker — check WCAG accessibility between two colors.
Frequently asked questions
- How do I convert HEX to RGB?
- Split the hex string into three 2-digit pairs (red, green, blue) and convert each pair from base 16 to base 10. For example, #3b82f6 splits into 3b, 82, f6 — which are 59, 130 and 246 in decimal, giving rgb(59, 130, 246).
- What is a HEX color code?
- A HEX code is a six-digit (or three-digit shorthand) base-16 number representing red, green and blue light intensity, written as #rrggbb. It is the most common way to write colors in CSS, design tools and image editors.
- What is the difference between HEX and RGB?
- They describe exactly the same color — HEX packs the three channels into a compact base-16 string, while RGB writes them out as three base-10 numbers from 0–255. Some tools and APIs expect one format over the other, which is why converting between them comes up often.
- Does this tool support 3-digit shorthand hex codes?
- Yes. A shorthand like #fff is expanded automatically (each digit is duplicated) to the equivalent full form, #ffffff, before conversion.
- Do I need to type the # symbol?
- No — the # is optional. Typing 3b82f6 or #3b82f6 produces the same result.
- Is my color data sent to a server?
- No. The conversion is plain arithmetic that runs entirely in your browser with JavaScript — nothing is uploaded or logged.