Brand & Design
What is a hex color?
A six-digit (or three-digit) hexadecimal representation of a color's red, green, and blue components, the most common way to write colors in CSS and design tools.
Also known as: hex code, hexadecimal color
A hex color like #2563eb encodes three bytes: 25 for red (37/255), 63 for green (99/255), eb for blue (235/255). A leading # is conventional in CSS and design tools. The three-digit shorthand #fff expands to #ffffff; an eight-digit form (#2563ebcc) adds an alpha channel.
Hex is convenient because it is dense (six characters versus rgb(37, 99, 235)) and unambiguous. It is also why most brand styleguides list colors as hex first: it is the format designers paste between Figma, the codebase, and a Slack message without conversion.
The downside is that hex is not perceptually meaningful: you cannot eyeball whether #7c3aed is brighter than #6d28d9 from the digits alone. For programmatic manipulation (deriving hover states, generating shade scales), HSL or OKLCH is much better. The pragmatic flow is: design and store as hex, manipulate as OKLCH, output as hex.
In the wild
- →
#635bffas Stripe's primary brand purple - →A CSS variable
--brand: #2563eb;referenced throughout a stylesheet - →A design token JSON file mapping
primary.500to#3b82f6
How Brand.dev uses hex color
Endpoints in the Brand.dev API where this concept comes up directly.
FAQ
Hex vs RGB vs HSL?
Hex is compact and copy-paste friendly. RGB is the same information in decimal. HSL (hue, saturation, lightness) is more intuitive to manipulate. OKLCH is the perceptually accurate modern option. Most design tools convert between them seamlessly.
What does `#fff3` mean?
A four-digit hex with alpha. Each digit doubles to make the full value: #fff3 = #ffffff33, which is white at 20% opacity.
Can hex represent any color?
It can represent any color in the sRGB color space, which is the default for the web. Wide-gamut colors (Display P3, Rec.2020) need newer CSS color functions like color() or oklch().
Related terms
A color model that represents colors as additive combinations of red, green, and blue light, used by every digital screen.
A subtractive color model used in print that mixes cyan, magenta, yellow, and black inks to produce colors on paper.
A standardized spot-color system used in print, where each color is a pre-mixed ink with a globally consistent reference number (e.g., Pantone 286 C).
The defined set of colors a brand or design system uses, typically organized into primary, secondary, neutral, and semantic groups.
Cascading Style Sheets, the language browsers use to style HTML: colors, typography, layout, animation, and responsive behavior.