Users reviews
We accept

The Use of the Hex System

How to Convert Numbers from the Hex to Decimal System?

Before finding out how to convert numbers from hex to decimal system, let’s discuss what the hex system is. The hexadecimal number system is a positional notation system for integer base of 16. As the figures of this number system the numbers from 0 to 9 and letters from A to F are commonly used. The letters A, B, C, D, E, F have the values of 1010, 1110, 1210, 1310, 1410, 1510, respectively.

The hex system is widely used in low-level programming and computer documentation, because modern computers’ minimum memory unit is the 8-bit byte, the value of which is convenient to write with two hexadecimal digits. Such use was commenced with IBM System/360, where all the records used the hexadecimal system, while the documentation of other computer systems of that time (even with 8-bit characters, such as, PDP-11 or BESM-6) used the octal system.

In the Unicode standard the number of the symbol is usually written in hexadecimal format, using no less than 4 digits (if necessary, with leading zeros).

The hex color is a record of three color component (R, G and B) in hexadecimal.

Methods of Recording

In mathematics, the radix of the system is specified in the decimal system in the subscript. For example, the decimal number 1443 can be written as 1443_10 or 5A3_16-.

In different programming languages, in order to write the hexadecimal numbers different syntax is used. For example:

  • In Ada and VHDL, the numbers are indicated as follows: «16 # 5A3 #».
  • In the C language and other syntax similar languages, for example, Java, the «0x» prefix is used. For example, «0x5A3».
  • Some assemblers use the letter «h», which is put after the number. For example, «5A3h». In this case, if the number does not begin with a decimal digit, in order to distinguish it from the names of identifiers (e.g., constants), it is placed in front of «0»: «0FFh» (25510).
  • Other assemblers (AT & T, Motorola), as well as Pascal and some versions of BASIC use the prefix «$». For example, «$5A3».
  • Some of the other platforms, such as the ZX Spectrum in its assemblers (MASM, TASM, ALASM, GENS, etc.) use the record #5A3, which is usually aligned to one or two byte: #05A3.
  • Other versions of BASIC, such as Turbo Basic, use the combination of «&h» or «&H» to indicate the hexadecimal before the number. For example, «&h5A3».
  • In Unix-like operating systems (and many programming languages with roots in the Unix/linux) non-printable characters in output/input encoded as 0xCC, where CC is the hexadecimal character code.

Conversion of Numbers from Hex to Decimal System

How to change a set of incomprehensible numbers and letters into something that can be understood by your computer or you personally? Converting the hex numbers to binary numbers can be easily done, that is why hexadecimal numbers are used in some programming languages. However, conversion of numbers from the hex to decimal can be a bit complicated, but it can be learned.

Hexadecimal Number System

In most cases, people use the decimal number system, which is based on ten digits. The hexadecimal system involves the use of sixteen characters that include both numbers and letters.

The hexadecimal characters are the following: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.

The order of hexadecimal number system (beginning with seventeen) is the following: 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B, 1C, 1D, 1E, 1F.

You need to use the subscript to show what system you are using. For this purpose the decimal number is used. For example, in 1710 is the number 17 in the decimal system (i.e. the usual decimal number 17); 1110 = 1016, i.e. the decimal number 11 is the number 10 in hexadecimal.

The hexadecimal numbers do not always include a letter. However if instead of the number you write a letter, it is clear that it is a hexadecimal system; for example, B = 1110.

Hexadecimal to binary

Convert each digit of the hexadecimal number in four digits of binary number. In fact, the hexadecimal system is a simple way to represent binary numbers. You can convert the digits from hexadecimal to binary system according to a special table.

In the binary system n digits can be used to represent the 2n numbers. For example, using four binary digits we can represent 24 = 16 numbers. As the sixteen hexadecimal system uses sixteen characters, one character may represent 161 = 16 numbers. This makes it easy to convert hexadecimal numbers into binary and vice versa.

Converting Hex to Decimal

People daily use decimals. Below there is a brief overview of how the decimal number system is to constructed (it will make it easier for you to convert numbers from different systems).

Each digit of a decimal number is at a certain place called position. Positions are counted from the right side of the number. The first position is the digits, the second position is the dozens, the third position is the hundreds, and so on. If the number 3 is in the first position, then this is number 3, if it is in the second positon, then it is 30, if it is in the third position, them it is 300.

Mathematically, the positions are described in the following way:100, 101, 102, and so on. Therefore, this system is called decimal.

Record a decimal number as a sum of some members. This will facilitate the understanding of the process of conversion of hex to decimal. For example, the number 48013710 (remember, the index 10 indicates that this is a decimal number). Start with the first digit on the right: 7 = 7 x 100, or 7 x 1. Then move from right to left: 3 = 3 x 101, or 3 x 10. And then 480.137 = 4x100.000 + 8x10.000 + 0x1.000 + 1x100 + 3x10 + 7x1.

In order to convert a number from hex to decimal, it is necessary each digit (starting from the right) of a hexadecimal number to multiply by 16 in the degree that corresponds to the figure. For example, let’s look at the hexadecimal number C92116. Start with the first digit on the right (1) and multiply it by 160 (the first digit is defined by the zero degree); increase the exponent of the fraction every time you move to the next digit (from the right to the left): 116 = 160 = 1 x 1 (all figures are presented in the decimal system except where noted). Then 216 = 2 x 161 = 2 x 16, 916 = 9 x 162 = 9 x 256, C = C x 163 = C x 4096.

After, convert alphabetic characters in decimal digits. The numbers have the same value both in decimal and hexadecimal systems (for example, 716 = 710). To convert alphabetical characters in the hexadecimal digits of the decimal system, see the following list: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.

Now perform calculations. Simply multiply the corresponding figures and add the multiplication results to obtain a decimal number. In our example of conversion hex to decimal: C92116 = (1 x 1) + (2 x 16) + (9 x 256) + (12 x 4096) = 1 + 32 + 2304 + 49152 = 5148910. The decimal numbers have more numbers than hexadecimal digits, because one digit of the hexadecimal system describes more information than a single digit of a decimal system.

In order to better understand how to convert numbers of hex to decimal, practice converting numbers. When converting big hexadecimal numbers, it is recommended to use online calculators. However, it is recommended to perform calculations by hand, in order to better understand the process of conversion the numbers from the hex to decimal system.

The algorithm of conversion numbers of hex to decimal system is good for converting numbers of any system into decimal numbers. Just replace the number 16 (in some fractions) by the corresponding number (in some fractions) in the other number system.

For making calculations from hex to decimal by hand and solving the examples of solutions and control tasks, you may find useful various tables of the substrate studied number systems (2, 8, 10, 16). After studying this section, there will be no difficulties for you in converting the numbers from hex to decimal.

More than 7 000 students trust us to do their work
90% of customers place more than 5 orders with us
Special price $10 /page
Check the price
for your assignment
Words min
Add commentaries
Type of service:
Custom writing
Academic level:
Get your $10 bonus now!
Hi! Every client is important to us, so we're giving you a $10 bonus. Create your first order and see for yourself - our service is working fine!