A hex color code uses six hexadecimal digits to represent a color. Format: #RRGGBB, where RR = red, GG = green, BB = blue. Values range from 00 (none) to FF (maximum).
Examples
- #FF0000 = Pure red
- #00FF00 = Pure green
- #0000FF = Pure blue
- #FFFFFF = White
- #000000 = Black
- #808080 = Gray (50%)
Shorthand
When pairs repeat, you can use 3-digit shorthand: #F00 = #FF0000, #0AF = #00AAFF.
Related Formats
RGB: rgb(255, 0, 0). HSL: hsl(0, 100%, 50%). RGBA adds transparency: rgba(255, 0, 0, 0.5).