Whereas the decimal system and its ten digits is deeply embedded in our daily lives, computer science and data pro­cessing rely heavily on the binary system, or binary code. The binary system makes it possible to represent complex situ­ations with just two states: 0 and 1. However, large binary numbers quickly become messy. This is where the hexa­decim­al system can be of help. In­form­a­tion that’s expressed using eight digits in the binary system can be expressed using just two hexa­decim­al numbers.

Cheap domain names – buy yours now
  • Free website pro­tec­tion with SSL Wildcard included
  • Free private re­gis­tra­tion for greater privacy
  • Free Domain Connect for easy DNS setup

What is the hexa­decim­al system?

The word hexa­decim­al is made up of the terms hexa and decimal. Hexa comes from the Greek and means ‘six’, whereas decem is the Latin word for ‘ten’. The hexa­decim­al system is thus a place-value system that rep­res­ents numbers using the base of 16. That means that the hexa­decim­al system uses 16 different digits. In other words, there are 16 possible digits, in contrast to the two in the binary system (0 and 1) and the ten in the decimal system (0 to 9). But what’s the purpose of the system?

What is the hexa­decim­al system used for?

The hexa­decim­al system is used in computer tech­no­logy and makes large numbers and long bit sequences more readable. They’re grouped into sections of four bits and then converted into hexa­decim­al numbers. The result is that a long sequence of ones and zeros get turned into shorter hexa­decim­al numbers, which can in turn be divided into groups of two or four. Hexa­decim­al numbers are thus a more compact way to represent bit sequences. The system is used for, for example, source and des­tin­a­tion addresses in Internet Protocols (IPs), in ASCII codes, or for de­scrib­ing colour codes in web design with the stylesheet language CSS.

Tip

Do you need a new website? The website builder MyWebsite offers pro­fes­sion­al design templates in modern colour com­bin­a­tions.

Hexa­decim­al system: How to write it

As mentioned above, the hexa­decim­al system uses 16 digits. This is where we run into a potential problem. In our tra­di­tion­al way of writing numbers we use the decimal numbers 10, 11, 12, 13, 14, and 15, which consist of two symbols put together. So if you were to use the number 10 in hexa­decim­al notation, it would be unclear what you mean.

To avoid this problem, the letters A through F are used to represent the numbers ten through 15 in the hexa­decim­al system. So in total, the numbers 0 through 9 and A through F are used to represent the equi­val­ents of binary numbers and decimal numbers. There are various notations available for dis­tin­guish­ing hexa­decim­al numbers from decimal numbers:

  • 7316
  • 73hex
  • 73h
  • 73H
  • 73H
  • 0x73
  • $73
  • #73
  • "73
  • X’73’

The prefix 0x and the suffix h are es­pe­cially common in pro­gram­ming, and the dollar prefix $ is fre­quently used in certain processor families in assembly language.

The re­la­tion­ship between hexa­decim­al numbers and binary numbers

When it comes to rep­res­ent­ing complex states, bit sequences and binary strings can get very long. In our daily use of the decimal system, we use groups of three digits to make big numbers like millions, billions, and trillions more readable. The same goes for digital systems. To make bit sequences like 11110101110011112 easier to read, they’re usually divided into groups of four. So our example would look like this: 1111 0101 1100 11112. It gets even easier to read when binary numbers are converted into the hexa­decim­al system.

Since sixteen is the fourth power of two (24), there’s a direct re­la­tion­ship between the numbers two and sixteen: one hexa­decim­al digit cor­res­ponds to four binary digits. That means that you can represent four digits from a binary number with a single hexa­decim­al digit. This makes the con­ver­sion between binary and hexa­decim­al numbers re­l­at­ively easy, and big binary numbers can be written in the hexa­decim­al system with fewer digits.

Note

In computer en­gin­eer­ing, one binary digit cor­res­ponds to one bit. A byte consists of eight bits, and a half byte (also referred to as a nibble consists of 4 bits. This means that a nibble can be rep­res­en­ted with one hexa­decim­al digit and a full byte with two hexa­decim­al digits.

Hexa­decim­al table for con­ver­sion into decimal and binary numbers

The hexa­decim­al system is more complex than the binary and decimal systems and is often used in con­nec­tion with memory addresses. Binary numbers are divided into groups of four bits, and each group of bits has a value between ‘0000’ and ‘1111’. This results in 16 different number com­bin­a­tions from 0 to 15. Note that ‘0’ is also a valid digit.

Decimal number 4 bit binary number Hexa­decim­al number
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F
16 0001 0000 10 (1+0)
17 0001 0001 11 (1+1)
18 0001 0010 12 (1+2)
19 0001 0011 13 (1+3)
20 0001 0100 14 (1+4)

According to the hexa­decim­al con­ver­sion table, the binary number sequence 1111 0101 1100 11112 from before will look like this in the hexa­decim­al system: F5CF. This number is much easier to read than the long sequence of bits. The hexa­decim­al system can be used to write digital code with fewer digits and thus less chance of making mistakes. Con­vert­ing hexa­decim­al numbers back into binary numbers can be done just as easily, using the same hexa­decim­al table above.

In order to make it clear that the number is a hexa­decim­al number, we can write it as follows: F5CF16, $F5CF, or #F5CF. The last notation, also called a hash value, is used for digital colour coding, since designers and de­velopers use hex colours in web design. Hex colours are rep­res­en­ted with a six-place com­bin­a­tion of numbers and letters de­term­ined by its mixture of red, green, and blue (RGB). #000000 stands for black and #FFFFFF for white.

Counting with hexa­decim­al numbers

Now you know how to convert binary numbers into hexa­decim­al numbers. If you’re working with more than four binary digits, simply start over or continue with the next set of four bits. With two hexa­decim­al digits you can count to FF, which cor­res­ponds to the decimal number 255.

Adding ad­di­tion­al hexa­decim­al digits in order to convert a binary number into a hexa­decim­al number is very easy when you have four, eight, twelve, or sixteen digits. But you can also add ‘0’ or ‘00’ to the left of the highest bit even if the number of binary digits is no longer a multiple of four. For example, 1100101101100112 is a fourteen-bit long binary number, which is too big for three hexa­decim­al digits but too small for four.

The solution is to add ad­di­tion­al zeros to the left end of the number until you have a full set of four-bit binary numbers. In our example that would look as follows: 001100101101100112.

Summary

The biggest advantage of the hexa­decim­al system is the com­pact­ness of its numbers, since fewer digits are required to represent a number than in binary or decimal notation. This is thanks to its base of sixteen. And it’s re­l­at­ively easy to convert binary numbers into hexa­decim­al numbers and vice versa.

Tip

You offer services, run an online shop, or are working on a website for the project you’re really pas­sion­ate about? Make a good im­pres­sion with your own email address and domain and benefit from high security for your sensitive data.

Go to Main Menu