What is a hex color?
A hex color is a code such as #FF5A1F that describes a color by how much red, green and blue light it contains. Each pair of characters is one amount, from 00 (none) to FF (full), written in base 16.
Action level No action usually needed
- Why you are seeing it
- It is a code such as #FF5A1F in web page styles, design tools and brand guides.
- Why it matters
- It describes a color by how much red, green and blue light it contains, so one short code can be copied exactly.
- What should I do?
- Read the code after the # as red, green and blue in pairs of characters.
- Use the same code in each place you need the same color.
- A common misunderstanding
- The same code can look a little different on different screens, and hex is only one way of writing a color: rgb(255, 90, 31) is the same orange.
Try a hex code
Type a code to see the color and its red, green and blue amounts.
#FF5A1F
- Red
- FF in hex = 255 out of 255
- Green
- 5A in hex = 90 out of 255
- Blue
- 1F in hex = 31 out of 255
- RGB
- 255, 90, 31
- HSL
- 16, 100%, 56%
- Each pair of characters is one color channel written in base 16: 00 is none of that light and FF is all of it.
A simple example
Reading #FF5A1F
Red: FF is 15 × 16 + 15 = 255.
Green: 5A is 5 × 16 + 10 = 90.
Blue: 1F is 1 × 16 + 15 = 31.
Together that is rgb(255, 90, 31), a strong orange.
How to read one
After the #, the first two characters are red, the next two green and the last two blue. Two hex digits can show 256 different amounts (16 × 16), which is exactly the range of one byte, 0 to 255.
- #000000 is black: no light at all.
- #FFFFFF is white: all three at full.
- Equal amounts of red, green and blue make a gray, such as #808080.
- A short form repeats each digit: #F80 means #FF8800. A longer form with two more characters adds transparency.
Where you will see them
Web page styles, design tools and brand guides all use hex codes, because one short code can be copied exactly. Two people using the same code ask for the same color, although different screens can show it a little differently.
Hex is one way of writing a color. The same orange can also be written as rgb(255, 90, 31) or in other notations, and converting between them changes the writing, not the color.
Try these tools
- Color PickerPick, convert and copy colors (HEX, RGB, HSL).
Want more detail? Read the longer guide: What is a hex color code, and how do you read one?