Toolzi LogoToolzi

HEX to RGB Converter

Convert HEX, RGB, and HSL color codes instantly.

Color Preview
HEX
RGB
HSL

What Are HEX, RGB, and HSL?

HEX, RGB, and HSL are three common ways to represent colors in web development. HEX uses a 6-digit hexadecimal code, RGB uses red/green/blue values (0–255), and HSL uses hue (0–360°), saturation, and lightness (0–100%).

HEX vs RGB vs HSL — When to Use Which

HEX

Most compact format. Commonly used in CSS for static colors and design tools. Example: #ff5733

RGB

Useful when you need to control opacity using rgba(). Directly maps to screen color channels. Example: rgb(255, 87, 51)

HSL

Most human-intuitive format. Easy to adjust brightness or saturation programmatically. Ideal for theming. Example: hsl(11, 100%, 60%)

How to Convert Color Codes

Click the color picker or type directly into any HEX, RGB, or HSL field. All other formats update instantly. Use the Copy buttons to copy each format to your clipboard.

Frequently Asked Questions

What is a HEX color code?
A HEX color code is a 6-digit hexadecimal number (e.g., #ff5733) representing the red, green, and blue components of a color, each ranging from 00 to ff.
How do I convert HEX to RGB?
Split the 6-digit HEX into three 2-digit pairs and convert each from base-16 to base-10. For example, #ff5733 → R: 255, G: 87, B: 51.
What is HSL color?
HSL stands for Hue, Saturation, and Lightness. Hue is the color angle (0–360°), saturation is color intensity (0–100%), and lightness is brightness (0–100%).
Which color format should I use in CSS?
All three formats are valid in CSS. HEX is most common for static colors, HSL is preferred for theming, and RGB is useful when you need rgba() for opacity control.
Can I convert a 3-digit HEX code?
Yes. A 3-digit HEX (e.g., #f53) is shorthand for #ff5533. Each digit is doubled to get the full 6-digit value.
Why does the HSL hue show 0 for a grey color?
Grey colors have 0% saturation, making the hue undefined. It defaults to 0 — this is expected behavior.
Is this color converter accurate?
Yes. The conversions use standard mathematical formulas and are accurate for all valid color inputs.

Related Tools