#RGB
CSS

Color Code Reference

Color code formats: HEX, RGB, HSL, RGBA, HSLA conversions, CSS color keywords, and web-safe palette reference.

📄 Free PDF Download

Print-friendly · 1-2 pages · No sign-up required

Download PDF

Color Format Comparison

Format Syntax Example (red) Notes
HEX #RRGGBB #FF0000 6 hex digits, 0-F each
HEX short #RGB #F00 3 digit = repeat each
HEX alpha #RRGGBBAA #FF0000FF AA = opacity (FF=100%)
RGB rgb(r,g,b) rgb(255,0,0) 0-255 per channel
RGBA rgba(r,g,b,a) rgba(255,0,0,1) a: 0=transparent, 1=opaque
HSL hsl(h,s%,l%) hsl(0,100%,50%) Hue 0-360, S/L 0-100%
HSLA hsla(h,s%,l%,a) hsla(0,100%,50%,1) With alpha channel
Named colorname red 148 CSS named colors

HEX to RGB Conversion

#FF6B35 → RGB
R = FF = 15*16 + 15 = 255
G = 6B = 6*16 + 11 = 107
B = 35 = 3*16 + 5  = 53
→ rgb(255, 107, 53)

# JavaScript
const hex = '#FF6B35';
const r = parseInt(hex.slice(1,3), 16);  // 255
const g = parseInt(hex.slice(3,5), 16);  // 107
const b = parseInt(hex.slice(5,7), 16);  // 53

Common CSS Named Colors

Color HEX Color HEX
white #FFFFFF black #000000
red #FF0000 green #008000
blue #0000FF yellow #FFFF00
gray #808080 silver #C0C0C0
orange #FFA500 purple #800080
pink #FFC0CB brown #A52A2A
cyan #00FFFF magenta #FF00FF
navy #000080 teal #008080
lime #00FF00 maroon #800000

HSL Hue Reference

Hue° Color
0° / 360° Red
30° Orange
60° Yellow
120° Green
180° Cyan
240° Blue
270° Violet
300° Magenta

Opacity Values

Alpha value HEX alpha Percent
1.0 FF 100% (opaque)
0.9 E6 90%
0.75 BF 75%
0.5 80 50%
0.25 40 25%
0.1 1A 10%
0.0 00 0% (transparent)

Free Online Tools for CSS

Keep This Reference Handy

Download the PDF and keep it on your desk or share with your team.

Download Color Code Reference PDF