HEX to RGB
Convert HEX color codes to RGB and HSL values
HEX to RGB converts a hex color code (like #7c3aed) into its RGB values (red, green and blue, each 0–255) and HSL values (hue, saturation, lightness), updating instantly as you type or pick a color.
How to use HEX to RGB
- 1
Type a hex color code, or use the color picker.
- 2
The RGB values (0–255 for red, green, blue) appear instantly.
- 3
The equivalent HSL values are shown alongside.
- 4
Copy whichever format your code or design tool needs.
Everything you need to know about HEX and RGB color codes
What's the difference between HEX and RGB?
Both describe the exact same color — they're just different notations. HEX (like `#7c3aed`) packs red, green, and blue values into a six-digit code; RGB (like `rgb(124, 58, 237)`) writes them out as three separate numbers from 0–255. Which one you need depends entirely on what you're writing code for — some contexts expect one format specifically.
When you actually need this
- Converting a design tool's color value into the format your CSS or codebase expects.
- Working with a color picked from an image (via Color Picker) that came back in a format you need to convert.
Going the other direction
Need to convert RGB back to HEX instead? RGB to HEX does the reverse.
Related Image Tools
Image Compressor
Compress images without visible quality loss
Image Resizer
Resize images to any dimension while preserving aspect ratio
Crop Image
Crop images to custom dimensions or aspect ratios
Rotate Image
Rotate images by any angle
Image Converter
Convert between JPG, PNG, WebP, AVIF, and SVG formats
SVG Converter
Convert SVG files to PNG, JPG or WebP
Frequently Asked Questions
Why do I need both RGB and HSL?
RGB is how screens actually store color, so it's what most code expects. HSL (hue, saturation, lightness) is easier for humans to reason about — for example, lowering lightness darkens a color without changing its hue, which isn't a simple operation in RGB.
Does this tool send my color to a server?
No — the conversion happens entirely in your browser; nothing you enter is transmitted or stored.
Does it support 3-digit hex codes like #fff?
Yes — shorthand 3-digit hex codes are expanded to their full 6-digit equivalent automatically before conversion.
Can I go the other way, from RGB to HEX?
Yes — use RGB to HEX for the reverse conversion.
Is this tool free to use?
Yes — completely free, with no signup required.