In the digital world, colors are often defined using what is known as a hex code. This means that over 16 million different colors and shades can be displayed. In this guide you will find out how exactly the hexadecimal color definition works and how you can find out the hex code of a certain color.
In order to understand how exactly hex codes for colors work, let’s first take a little excursion into the hexadecimal system, because the word “Hex” in hex code stands for hexadecimal number.
In everyday life we almost exclusively use the decimal system for arithmetic. This consists of ten digits (0 to 9). If a number reaches a value higher than nine, a new digit is “opened” in order to be able to represent the number, such as the number 13. It is therefore a number system with a base of 10.
In the hexadecimal system, on the other hand, numbers are represented in a place value system based on base 16. It consists of 16 hexadecimal digits. There is a special feature here. Since our Indo-Arabic number system only knows ten digits, the missing six hexadecimal digits above nine cannot be represented with a number. That is why the letters A to F are used for this. The hexadecimal number A is converted into the decimal system, i.e. 10, B is 11 and F is 15.
The hexadecimal system is preferred for use in electronic data processing. As a fourth power of two (2 ^ 4 = 16), the hexadecimal system is well suited for convenient management of the binary system.
Now that you know how the hexadecimal system works, we can now look at how hexadecimal numbers are used in color definition. The hex code for colors consists of six digits, usually preceded by a hash (#). Two digits each indicate the mixing ratios of the colors red, green and blue (RGB) in the hex code. A hex code for a color has the following scheme: #RRGGBB.
One of 16 hexadecimal digits can appear at any point in the code. Since the three colors are each defined over two places, there are 256 states (16 x 16 digits) per color. If we now combine every possible mixing ratio of the three colors, we get 16,777,216 colors (256 x 256 x 256). This is also referred to as a color depth of 24 bits (2 ^ 24 = 16,777,216).
In the following table you will now find some basic and mixed colors and their associated hex code. You will also find the color coding in the decimal system in RGB format.
Color Hex value RGB decimal Black # 000000 0 | 0 | 0 white #FFFFFF 255 | 255 | 255 gray # 888888 136 | 136 | 136 red # FF0000 255 | 0 | 0 green # 00FF00 0 | 255 | 0 blue # 0000FF 0 | 0 | 255 cyan # 00FFFF 0 | 255 | 255 magenta # FF00FF 255 | 0 | 255 yellow # FFFF00 255 | 255 | 0 teal # 00FF88 0 | 255 | 136 sky blue # 0088FF 0 | 136 | 255 purple # 8800FF 136 | 0 | 255 rose # FF0088 255 | 0 | 136 orange # FF8800 255 | 136 | 0 yellow green # 88FF00 136 | 255 | 0
The hex code for the background color for the lettering “from SATURN” is, for example, 25A8D4.
If you want to use a certain color, for example when programming in HTML or in image processing software, it is very helpful to know its hex code. If you have a picture that shows the color you want, you can use the Image-Color website Find out the exact hex code for the color and then use it yourself.
To do this, you must first upload the image to the site. Then click on the desired color in the uploaded picture with the cursor and the website will tell you the corresponding hex code.
- Hex code for colors consists of six digits preceded by a diamond. Two digits each define the color components of red, green and blue (RGB).
- The six digits in the hex code are not decimal but hexadecimal numbers. These are represented with the digits from 0 to 9 and the letters A to F for the numbers from 10 to 15.
- A total of 16,777,216 colors can be displayed using the six-digit hex code. One speaks here of a color depth of 24 bit.
- If you want to find out the hex code of a certain color on an image, you can upload the image to the Image-Color website and have the respective code displayed there.