Using hexadecimal

Hex codes are used in many areas of computing to simplify binary codes. It is important to note that computers do not use hexadecimal - it is used by humans to shorten binary to a more easily understandable form. Hexadecimal is translated into binary for computer use. Some examples of where hex is used include:


Hex can be used to represent colours on web pages and image-editing programs using the format #RRGGBB (RR = reds, GG = greens, BB = blues). The # symbol indicates that the number has been written in hex format.

This system uses two hex digits for each colour, eg #FF6600.

Colours can be described in hex in the format RRGGBB

As one hex digit represents 4 bits, two hex digits together make 8 bits (1 byte). The values for each colour run between 00 and FF. In binary, 00 is 0000 0000 and FF is 1111 1111. That provides 256 possible values for each of the three colours.

That gives a total spectrum of 256 reds x 256 greens x 256 blues - which is over 16 million colours in total.

#FF0000 will be the purest red - red only, no green or blue.

Black is #000000 - no red, no green and no blue.

White is #FFFFFF.

An orange colour can be represented by the code #FF6600. The hex code is much easier to read than the binary equivalent 1111 1111 0110 0110 0000 0000.

If you are making a web page with HTML or CSS you can use hex codes to choose the colours.

RGB colour model

Hex values have equivalents in the RGB colour model. The RGB model is very similar to the hex colour model, but instead of combining hex values you use a value between 0 and 255 for each colour. So an orange colour that is #FF6600 in hex would be 255, 102, 0 in RGB.


Hex is often used in error messages on your computer. The hex number refers to the memory location of the error. This helps programmers to find and then fix problems.