What Is a HEX Color?

Learn how HEX color codes work, why they're used in web design, and how to read and use them in your projects.

Understanding HEX

A HEX color is a six-digit hexadecimal code that represents a color. Hexadecimal (base-16) uses digits 0-9 and letters A-F, allowing compact color representation.

Format: #RRGGBB where each pair represents Red, Green, and Blue intensity from 00 (0%) to FF (100%).

Example: #7357F6 breaks down to:

  • 73 (115 decimal) = Red
  • 57 (87 decimal) = Green
  • F6 (246 decimal) = Blue

Why HEX is popular

  • Web standard: Works in all browsers and design tools
  • Compact: Only 6 characters vs longer formats
  • Copyable: Easy to share and paste into code
  • Consistent: #FF0000 is always the same red everywhere

HEX variants

3-digit shorthand: #F0F expands to #FF00FF when both digits in each pair are identical.

8-digit HEX: #7357F680 includes alpha (transparency). The last two digits represent opacity from 00 (transparent) to FF (opaque).