All original content is created in Ukrainian. Not all content has been translated yet. Some posts may only be available in Ukrainian.Learn more

What is a HEX color? How many HEX colors can there be?

This content has been automatically translated from Ukrainian.
HEX (or hexadecimal code) is a numbering system that uses 16 symbols to represent numbers. It includes the digits from 0 to 9 and six letters from A to F, which correspond to decimal values from 10 to 15. In the hexadecimal numbering system, each digit is represented by 4 bits.
For example:
  • 0 in HEX = 0 in decimal
  • 1 in HEX = 1 in decimal
  • 9 in HEX = 9 in decimal
  • A in HEX = 10 in decimal
  • F in HEX = 15 in decimal
  • 10 in HEX = 16 in decimal
  • 1F in HEX = 31 in decimal
The hexadecimal code is widely used in programming, especially for representing memory addresses, colors in web design, and other cases where compactness and convenience of representing binary information are important.

What is a HEX color and how does it work?

HEX color uses a hexadecimal code to represent colors in web design and other digital media. Each HEX color consists of six symbols that represent triplets of values for the red (R), green (G), and blue (B) channels. It is displayed in the format #RRGGBB, where each pair of symbols corresponds to one byte (eight-bit value) for each color.
For example:
  • #FF0000 represents pure red (255 for R, 0 for G and B).
  • #00FF00 represents pure green (0 for R, 255 for G, and 0 for B).
  • #0000FF represents pure blue (0 for R and G, 255 for B).
  • #FFFFFF represents white (255 for all three channels).
Color in HEX format allows for precise color specification and easy interaction with them in web development. Each channel can take values from 00 to FF (from 0 to 255 in decimal), allowing for a wide range of colors. Mixing different values of R, G, and B allows for many different shades and colors.

How many HEX colors can there be?

A HEX code for a color is represented by a hexadecimal number that is six symbols long. Each of these symbols can take one of 16 possible values (0-9 and A-F or a-f), making 16 options for each of the six symbols.
Therefore, the total number of possible HEX colors can be calculated as 16 to the power of 6 (since there are six symbols). This equals 16,777,216 possible colors. This includes all possible combinations of red, green, and blue colors, allowing for a wide range of shades and saturations.

Short notation of HEX color

There is a short notation for HEX color (previously we discussed the version with 6 symbols). In the short notation, each of the three channels (red, green, blue) is shortened to one symbol if both symbols of the channel are the same. For example, if the red channel has the value "AA", the green channel "BB", and the blue channel "CC", then the short notation will be "#ABC".
Thus, the short notation of HEX color allows for more efficient storage and transmission of color information, especially if both symbols for each channel are equal.

Is there transparency in HEX colors?

Transparency can be used in HEX colors by adding an additional byte that indicates the level of transparency. This byte is added to the standard HEX color code and is called the alpha channel.
The standard HEX code has the format #RRGGBB, where RR corresponds to the red channel, GG to the green, and BB to the blue. If the alpha channel is added, the format will look like this: #RRGGBBAA. The alpha channel defines the degree of transparency, where 00 indicates full transparency, and FF indicates full opacity.
For example:
  • #FF0000FF represents red with full opacity.
  • #00FF00A0 represents green with half transparency.
This format is sometimes used in web design (more detailed information can be read here) and graphics to create transparent or semi-transparent elements.

This post doesn't have any additions from the author yet.

09 Jun 17:34

Table of classic RAL colors (RAL Classic). HEX values, names in English and Ukrainian.

Щось про кольори
Щось про кольори@clrad
31 Jan 23:34

What is RGB? How is it different from HEX?

Щось про кольори
Щось про кольори@clrad
31 Jan 23:44

What is HSL? Where is it used? Does it have an alpha channel?

Щось про кольори
Щось про кольори@clrad
31 Jan 23:55

What is HSV? Where is it used? How does it differ from HSL?

Щось про кольори
Щось про кольори@clrad
01 Feb 00:05

What is CMYK? Where is it used? How many colors can exist?

Щось про кольори
Щось про кольори@clrad
Names of colors in Ukrainian and their HEX, CMYK, and HSL values
01 Feb 00:12

Names of colors in Ukrainian and their HEX, CMYK, and HSL values

Щось про кольори
Щось про кольори@clrad