How to Convert RGB to HEX (Free Color Tool + Method)
RGB and HEX are two ways of writing the same color — RGB as three numbers (0–255), HEX as a six-digit code like #6366F1. Designers and developers constantly convert between them. This guide shows how to convert RGB to HEX (and back) for free with a live picker, and how the conversion actually works.
🎨 Try the Color Converter (HEX RGB HSL) now — freeOpen →Different tools expect different formats: a design file gives you RGB, but your CSS needs HEX, or vice versa. Converting by hand means base-16 math; a converter makes it instant and exact, so your colors stay consistent everywhere.
How RGB and HEX relate
Both describe a color by its red, green and blue components. RGB writes each as a number from 0 to 255, like rgb(99, 102, 241). HEX writes the same three values in hexadecimal (base 16), two digits each: #63 66 F1. So 99 in decimal becomes 63 in hex, 102 becomes 66, and 241 becomes F1 — giving #6366F1.
That's the whole conversion: each RGB channel (0–255) maps to a two-digit hex pair (00–FF). A converter does the base-16 math instantly in both directions.
When to use each format
- HEX — compact and standard in CSS and design handoffs.
- RGB — easy to read as numbers, and RGBA adds transparency.
- Either — modern CSS accepts both, so pick what's easiest to edit.
- Use the live picker to explore and grab exact values.
- Keep one format consistent across a project for cleaner code.
Step-by-step
Common mistakes to avoid
Pro tips
Frequently asked questions
How do I convert RGB to HEX?
Each RGB value (0–255) becomes a two-digit hexadecimal pair. rgb(99,102,241) = #6366F1. A converter does it instantly.
How do I convert HEX to RGB?
Split the six-digit code into three pairs and convert each from hex to a 0–255 number. The tool does both directions.
Which format should I use?
HEX is compact and standard for CSS; RGB (or RGBA for transparency) is easy to read as numbers. Modern CSS accepts both.
Is it free?
Yes — free with no sign-up, with a live color picker in your browser.
Can I add transparency?
Use RGBA (or 8-digit HEX), which add an alpha channel. Plain 6-digit HEX doesn't carry transparency.
RGB and HEX are two ways of writing the same color — each RGB channel maps to a two-digit hex pair. A converter with a live picker moves between them instantly, so grab HEX for CSS, RGBA for transparency, and keep your colors consistent everywhere. Free in your browser.