Hex colour code
A hex colour code writes a colour as a # followed by six hexadecimal digits: two each for red, green and blue, from 00 to FF. #FF0000 is pure red and #FFFFFF is white.
Each pair of digits is a number from 0 to 255 written in base 16, so #1E90FF means red 30, green 144 and blue 255. CSS also accepts a three-digit short form, where #F00 means #FF0000, and eight-digit codes that add an opacity value at the end.
Hex codes are how brand guidelines usually give a brand’s screen colours, next to Pantone or CMYK values for print. Pick and convert colours in our colour wheel, browse 5,000 named colours with their codes, or see the most common brand colours in our Brand Colour Index.
Related terms
- Brand guidelines: Brand guidelines, also called a brand book or style guide, are a document setting the rules for using a brand’s identity: logo versions, clear space, minimum sizes, colours, typefaces and examples of misuse.
- Contrast ratio: Contrast ratio measures how different two colours are in brightness, from 1:1 (identical) to 21:1 (black on white). WCAG asks for at least 4.5:1 for normal text and 3:1 for large text.
Sources
- developer.mozilla.org: A hex colour gives an sRGB colour by its red, green and blue components written in hexadecimal, optionally with transparency
- developer.mozilla.org: Hex colours accept 3, 4, 6 and 8-digit syntaxes
More terms in Colour or the full glossary.