Color Converter: HEX, RGB & HSL
Paste a HEX, RGB or HSL color and instantly get every other format. The converter detects the format automatically and validates your input.
Supported Conversions
- HEX to RGB and RGB to HEX
- RGB to HSL and HSL to RGB
- HEX to HSL and HSL to HEX
Accepted inputs include #6C5CE7, 6C5CE7, short HEX like #FFF, rgb(108, 92, 231) and hsl(247, 75%, 63%).
How Conversion Works
HEX ↔ RGB
A HEX code is three pairs of hexadecimal digits. Each pair converts to a number from 0 to 255: 6C = 108, 5C = 92, E7 = 231, so #6C5CE7 = rgb(108, 92, 231).
RGB ↔ HSL
HSL is calculated from the highest and lowest RGB channels. Lightness is their average, saturation measures how far the color is from grey, and hue is the angle on the color wheel based on which channel is strongest.
Common Conversions
| Color | HEX | RGB | HSL |
|---|---|---|---|
| Black | #000000 | rgb(0, 0, 0) | hsl(0, 0%, 0%) |
| White | #FFFFFF | rgb(255, 255, 255) | hsl(0, 0%, 100%) |
| Red | #FF0000 | rgb(255, 0, 0) | hsl(0, 100%, 50%) |
| Green | #008000 | rgb(0, 128, 0) | hsl(120, 100%, 25%) |
| Blue | #0000FF | rgb(0, 0, 255) | hsl(240, 100%, 50%) |
Tips
- Need a single direction? Use the focused HEX to RGB or RGB to HEX converters.
- Need print values? Convert screen colors with the RGB to CMYK Converter.
- HSL values are rounded to whole numbers, so converting back to HEX may differ by one step in rare cases.
- Use HSL when you want to make a color lighter or darker while keeping the same hue.
Related Learning Guides
Frequently Asked Questions
How do I convert HEX to RGB?
Paste the HEX code (for example #6C5CE7) into the input. The RGB value appears instantly: rgb(108, 92, 231).
Do I need to include the # symbol?
No. Both #6C5CE7 and 6C5CE7 are accepted.
Can I convert short HEX codes?
Yes. Three-digit codes such as #FFF are expanded to #FFFFFF.
Why does my input show an error?
The value is not a valid HEX, RGB or HSL code, or a number is out of range. RGB values must be 0–255; HSL hue 0–360 and saturation/lightness 0–100%.
Does the converter support transparency?
Alpha values in rgba() and hsla() are accepted, but the output shows the solid color. Use the Color Picker for transparent colors.