What is a hex color code, and how do you read one?
A hex color code such as #FF8000 is a compact way of describing a color on a screen. The hash sign says it is hex, and the six characters after it are three pairs: how much red, green and blue to mix.
Reading the pairs
Each pair is a number from 00 to FF in base 16, which is 0 to 255 in everyday counting. The letters A to F stand for 10 to 15. So FF is 15 × 16 + 15 = 255, and 80 is 8 × 16 + 0 = 128.
Breaking down #FF8000
Red: FF = 255
Green: 80 = 128
Blue: 00 = 0
As RGB: rgb(255, 128, 0), a bright orange
The short form
When both digits of every pair match, the code can be shortened to three characters, and each digit is doubled. So #F80 means #FF8800, which is a very slightly different orange from #FF8000. The short form is only an exact match when each pair repeats.
How many colors?
With 256 values for each of three channels there are 256 × 256 × 256 = 16,777,216 possible colors.
Some useful anchors
- #000000 is black: no light in any channel.
- #FFFFFF is white: every channel at full.
- Equal pairs, like #808080, give a gray.
- A higher first pair makes the color redder, the middle greener, the last bluer.
Capital or lower case?
Hex codes are not case sensitive, so #ff8000 and #FF8000 are the same color. Pick one style for a project and keep to it, because consistent codes are easier to search for and compare. Some tools also accept an extra pair at the end that sets transparency, which is worth checking before you copy a code from one place to another.
Color Picker: Pick a color or paste a hex code to see its RGB and HSL values.