Overview
Web and design tools describe colors in several formats. This converter takes RGB values and gives you hex and HSL.
Enter red, green and blue from 0 to 255.
Worked examples
| Inputs | Result |
|---|---|
| red (0-255)59green (0-255)104blue (0-255)252 | Hex: #3B68FCRGB: rgb(59, 104, 252)HSL: hsl(226, 97%, 61%) |
Show 2 more examples
| red (0-255)255green (0-255)87blue (0-255)51 | Hex: #FF5733RGB: rgb(255, 87, 51)HSL: hsl(11, 100%, 60%) |
| red (0-255)0green (0-255)128blue (0-255)128 | Hex: #008080RGB: rgb(0, 128, 128)HSL: hsl(180, 100%, 25%) |
How it works
Hex writes each channel as two hexadecimal digits. HSL expresses the same color as hue, saturation and lightness.
The formula
Hex = #RRGGBB · L = (max + min) ÷ 2
| RR, GG, BB | Each channel in base 16 |
Practical tips
- rgb(59, 104, 252) is #3B68FC, or hsl(226, 97%, 61%).
- HSL is easier for making lighter or darker shades.
- In CSS, an extra two hex digits set transparency.
Frequently asked questions
What is #FFFFFF?
White: all channels at maximum.
How do I convert hex to RGB?
Convert each pair of digits from base 16: 3B = 59.