Hexadecimal numbers

The hexadecimal system It is made up of a group of alpha numeric characters, ranging from 0 to 9 and from letter A to F, where each one has a different number. Following the sequence of the numbers the letters would be A = 10, B = 11, C = 12, D = 13, E = 14, F = 15. The base is 16 which is used to represent the numbers. Let's see an example:

8DF → 8 × 162 + D × 161 + F × 100

8DF → 8 × 162 + 13 × 161 + 15 × 160

8DF → 2048 + 208 + 15

8DF16 → 227110

We have transformed 8DF to the decimal system, 8DF = 2271.

Converting a decimal number to hexadecimal

Example 1:

Hexadecimal numbers example

  • We divide decimal 678 by 16 (which is the base of hexadecimal numbers) and we get 42.
  • We take the remainder of each division as the hexadecimal number, in this case, 6.
  • We continue dividing 42 by 16, result 2, we take the remainder 10 = A as a number.
  • Finally, the number that we will take as hexadecimal will be the last result that cannot be divided by 16, in this case, 2.

The result is written in ascending order taking 2, then A and finally 6.

Example 2:

Hexadecimal numbers example 2

  • As a decimal number we have 1023, we divide it by 16 (which is the base of hexadecimal numbers) and we get 63 as a result.
  • We take the remainder of each division as the hexadecimal number, in this case, 15 = F.
  • We divide 63 by 16, we get 3 as the last result (which will also be a hexadecimal number) and its remainder 15 = F.
  • The final hexadecimal number will be written starting from the last result of the division and from the last remainder to the first one obtained, we can say that 1023 = 3FF.