RGB vs HEX vs HSL
All three formats — RGB, HEX and HSL — describe the same colors. They differ in how they expose the underlying channels, and in which scenarios they are most useful.
RGB
RGB lists three channels 0–255: rgb(255, 0, 0) for red. It's explicit, easy to compute, and always understandable. Use RGB when you need to manipulate individual channels programmatically.
HEX
HEX is a compact base-16 representation: #FF0000 for the same red. It's what designers use most. Best for CSS, design tools and any place where compact strings matter.
HSL
HSL separates hue (0–360°), saturation (0–100%) and lightness (0–100%): hsl(0, 100%, 50%). HSL makes it easy to lighten a color (change L) or desaturate (change S) without touching the hue. Best for building color systems and adjusting palettes.
Conversion formulas
- HEX → RGB: parse each 2-digit pair as base-16.
- RGB → HEX: format each channel to 2-digit hex.
- RGB → HSL: use the standard CSS Color Module formula.
- HSL → RGB: use the hue2rgb conversion.
Practical guidance
Store colors as HSL in design systems for easier manipulation. Publish as HEX in CSS for compactness. Use RGB in canvas, WebGL and any programmatic context. Our color picker shows all formats simultaneously.