What Does the 8-Digit CSS Hex Color Code Represent?

Find out what the extra two digits in CSS hexadecimal color format represent

Introduced in the CSS Colors Module Level 4 specification, the new 8-digit notation for hexadecimal color code adds an extra two characters at the end for (optionally) specifying alpha channel information. This syntax has good support among modern browsers. It has the following format:


In this form, the alpha channel values are specified in hexadecimal number format. They range between 0 (the minimum value) and f (the maximum value). For example, the following shows different values applied to the alpha channel of the color #0000ff:

#0000ff00; // 0 opacity
#0000ff40; // 25% opacity
#0000ff80; // 50% opacity
#0000ffbf; // 75% opacity
#0000ffff; // 100% opacity

Since the values are in hexadecimal number format, 40 represents 25%, 80 represents 50%, and so on. For a complete list of possible values for the alpha channel, refer to the following:

Hope you found this post useful. It was published . Please show your love and support by sharing this post.