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

$1 Domain Names – Register yours today!
  • Simple reg­is­tra­tion
  • Premium TLDs at great prices
  • 24/7 personal con­sul­tant included
  • Free privacy pro­tec­tion for eligible domains

What is the hexa­dec­i­mal system?

The word hexa­dec­i­mal 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­dec­i­mal system is thus a place-value system that rep­re­sents numbers using the base of 16. That means that the hexa­dec­i­mal 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­dec­i­mal system used for?

The hexa­dec­i­mal system is used in computer tech­nol­o­gy and makes large numbers and long bit sequences more readable. They’re grouped into sections of four bits and then converted into hexa­dec­i­mal numbers. The result is that a long sequence of ones and zeros get turned into shorter hexa­dec­i­mal numbers, which can in turn be divided into groups of two or four. Hexa­dec­i­mal numbers are thus a more compact way to represent bit sequences. The system is used for, for example, source and des­ti­na­tion addresses in Internet Protocols (IPs), in ASCII codes, or for de­scrib­ing color 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 color com­bi­na­tions.

Hexa­dec­i­mal system: How to write it

As mentioned above, the hexa­dec­i­mal 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­dec­i­mal 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­dec­i­mal system. So in total, the numbers 0 through 9 and A through F are used to represent the equiv­a­lents of binary numbers and decimal numbers. There are various notations available for dis­tin­guish­ing hexa­dec­i­mal 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­cial­ly common in pro­gram­ming, and the dollar prefix $ is fre­quent­ly used in certain processor families in assembly language.

The re­la­tion­ship between hexa­dec­i­mal numbers and binary numbers

When it comes to rep­re­sent­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­dec­i­mal 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­dec­i­mal digit cor­re­sponds to four binary digits. That means that you can represent four digits from a binary number with a single hexa­dec­i­mal digit. This makes the con­ver­sion between binary and hexa­dec­i­mal numbers rel­a­tive­ly easy, and big binary numbers can be written in the hexa­dec­i­mal system with fewer digits.

Note

In computer en­gi­neer­ing, one binary digit cor­re­sponds 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­re­sent­ed with one hexa­dec­i­mal digit and a full byte with two hexa­dec­i­mal digits.

Hexa­dec­i­mal table for con­ver­sion into decimal and binary numbers

The hexa­dec­i­mal 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­bi­na­tions from 0 to 15. Note that “0” is also a valid digit.

Decimal number 4 bit binary number Hexa­dec­i­mal 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­dec­i­mal con­ver­sion table, the binary number sequence 1111 0101 1100 11112 from before will look like this in the hexa­dec­i­mal system: F5CF. This number is much easier to read than the long sequence of bits. The hexa­dec­i­mal system can be used to write digital code with fewer digits and thus less chance of making mistakes. Con­vert­ing hexa­dec­i­mal numbers back into binary numbers can be done just as easily, using the same hexa­dec­i­mal table above.

In order to make it clear that the number is a hexa­dec­i­mal number, we can write it as follows: F5CF16, $F5CF, or #F5CF. The last notation, also called a hash value, is used for digital color coding, since designers and de­vel­op­ers use hex colors in web design. Hex colors are rep­re­sent­ed with a six-place com­bi­na­tion of numbers and letters de­ter­mined by its mixture of red, green, and blue (RGB). #000000 stands for black and #FFFFFF for white.

Counting with hexa­dec­i­mal numbers

Now you know how to convert binary numbers into hexa­dec­i­mal 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­dec­i­mal digits you can count to FF, which cor­re­sponds to the decimal number 255.

Adding ad­di­tion­al hexa­dec­i­mal digits in order to convert a binary number into a hexa­dec­i­mal 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­dec­i­mal 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­dec­i­mal 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 rel­a­tive­ly easy to convert binary numbers into hexa­dec­i­mal numbers and vice versa.

Tip

You offer services, run an online store, 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