HEX Colors
Format: #RRGGBB (e.g., #c41e1e). The most common CSS format. Compact but hard to modify mentally. Shorthand available: #RGB expands to #RRGGBB.
RGB Colors
Format: rgb(196, 30, 30). Defines red, green, blue channels (0-255). More readable than HEX. RGBA adds alpha transparency: rgba(196, 30, 30, 0.8).
HSL Colors
Format: hsl(0, 73%, 44%). Defines hue (0-360°), saturation (0-100%), lightness (0-100%). The most intuitive format — easy to create variations by adjusting one value.
Which Should You Use?
- HEX for static colors and design hand-offs
- RGB for JavaScript manipulation and canvas
- HSL for CSS design systems and dynamic theming
- HSLA/RGBA when you need transparency
Frequently Asked Questions
Can I mix color formats in CSS?
Yes. Browsers handle all formats. But pick one for consistency. HSL is best for design systems because you can easily create shades.
Which format do design tools use?
Figma and Sketch default to HEX. Photoshop uses RGB. CSS-focused designers increasingly prefer HSL.