HEX to RGB — HEX codes like #4f46e5 are shorthand for RGB values. This converter expands any 3- or 6-digit HEX code into its rgb() and hsl() CSS equivalents, with a live preview swatch.
Conversion runs locally in your browser.
Was HEX to RGB useful?
What is HEX to RGB?
HEX codes like #4f46e5 are shorthand for RGB values. This converter expands any 3- or 6-digit HEX code into its rgb() and hsl() CSS equivalents, with a live preview swatch.
Invalid input is flagged immediately so you never copy a broken value into your stylesheet.
How to use it
-
Enter a HEX code
With or without the leading #, 3 or 6 digits.
-
Copy RGB or HSL
Both formats appear with copy buttons.
Examples
Shorthand expands
#f80 expands to the same color as #ff8800.
#f80
Result: rgb(255, 136, 0)
Frequently asked questions
Related guides
How to Test Color Contrast for Accessibility
Learn how WCAG 2.2 calculates relative luminance contrast ratios, the 4.5:1 AA and 7:1 AAA thresholds, and how to test palettes in your browser.
How to Make a Color Palette from a Photo
Extract cohesive color palettes from photos using eyedropper sampling or quantization, add neutrals, and verify WCAG contrast ratios locally.
The 8 Best Free Color Tools for Designers in 2026
Eight free browser-based color tools for designers: picker, harmony palette generator, WCAG contrast checker, CSS name finder, and gradient builder.