How to convert hexadecimal numbers to binary or decimal

Author: Mark Sanchez
Date Of Creation: 28 January 2021
Update Date: 1 July 2024
Anonim
Binary, Hexadecimal, and Decimal Conversion – Simple Explanation | Basic Electronics
Video: Binary, Hexadecimal, and Decimal Conversion – Simple Explanation | Basic Electronics

Content

How can you change this set of incomprehensible numbers and letters so that it becomes understandable for your computer or for you personally? It is very easy to convert hexadecimal numbers to binary, which is why hexadecimal numbers are used in some programming languages. Converting hexadecimal numbers to decimal numbers is a bit tricky, but you can learn it too.

Steps

Part 1 of 3: Converting Hexadecimal Numbers to Binary

  1. 1 Convert each digit of a hexadecimal number to four digits of a binary number. Basically, the hexadecimal system is a simplified way of representing binary numbers. Convert numbers from hexadecimal to binary according to the following table:
    HexadecimalBinary
    00000
    10001
    20010
    30011
    40100
    50101
    60110
    70111
    81000
    91001
    A1010
    B1011
    C1100
    D1101
    E1110
    F1111
  2. 2 Try converting a hexadecimal number to binary yourself. Here are some examples. Highlight the invisible text to the right of the equal sign to see the answer and test yourself.
    • A23 = 1010 0010 0011
    • BEE = 1011 1110 1110
    • 70C558 = 0111 0000 1100 0101 0101 1000
  3. 3 Understand the principle of transformation. In binary n digits can be used to represent 2 different numbers. For example, using four binary digits, you can represent 2 = 16 numbers. Since the hexadecimal system uses sixteen characters, one character can represent 16 = 16 numbers. This makes it easier to convert hexadecimal to binary numbers and vice versa.
    • You can also imagine how the counting goes to the next digit in each system. Hexadecimal "... D, E, F, 10", and in binary -" 1101, 1110, 1111, 10000’.

Part 2 of 3: Converting Hexadecimal Numbers to Decimals

  1. 1 Remember how the decimal number system works. You use decimal numbers every day without thinking about how they work, but when you first started studying them in school, the teacher explained to you what units, tens, hundreds, and so on. Below we will briefly remind you of how the decimal number system works, which will help you convert numbers.
    • Each digit of a decimal number is in a specific place called a place. The digits are counted from right to left. The first category is units, the second category is tens, the third category is hundreds, and so on. If the number 3 is in the first digit, then this is the number 3, if in the second - then 30, if in the third - then 300.
    • Mathematically, the digits can be described as follows: 10, 10, 10, and so on. Therefore, this system is called decimal.
  2. 2 Write down the decimal number as the sum of some terms. This will make it easier to understand the process of converting hexadecimal numbers to decimal numbers. For example, the number 48013710 (remember that the index 10 means that the given number is decimal).
    • Starting with the first digit on the right: 7 = 7 x 10, or 7 x 1
    • Moving from right to left: 3 = 3 x 10, or 3 x 10
    • 480137 = 4x100 000 + 8x10 000 + 0x1 000 + 1x100 + 3x10 + 7x1.
  3. 3 To convert a hexadecimal number to decimal, each digit (starting from the right) of the hexadecimal number must be multiplied by 16 to the power corresponding to the digit of this digit. For example, consider the hexadecimal number C92116... Start with the first digit on the right (1) and multiply it by 16 (the first digit is given by the zero degree); increase the exponent each time you move to the next digit (from right to left):
    • 116 = 1 x 16 = 1 x 1 (all digits are in decimal except where noted)
    • 216 = 2 x 16 = 2 x 16
    • 916 = 9 x 16 = 9 x 256
    • C = C x 16 = C x 4096
  4. 4 Convert alphabetic characters to decimal digits. The numbers have the same meaning in both decimal and hexadecimal systems (for example, 716 = 710). Use the following list to convert alphabetic hexadecimal characters to decimal digits:
    • A = 10
    • B = 11
    • C = 12
    • D = 13
    • E = 14
    • F = 15
  5. 5 Perform calculations. Now, simply multiply the corresponding digits and add the multiplication results to get the decimal number. In our example:
    • C92116 = (1 x 1) + (2 x 16) + (9 x 256) + (12 x 4096)
    • = 1 + 32 + 2304 + 49152.
    • = 5148910... The decimal number has more digits than the hexadecimal number because one hexadecimal digit describes more information than one decimal digit.
  6. 6 Practice converting numbers. Here are some hex-to-decimal conversion tasks. Highlight the invisible text to the right of the equal sign to see the answer and test yourself.
    • 3AB16 = 93910
    • A1A116 = 4137710
    • 500016 = 2048010
    • 500D16 = 2049310
    • 18A2F16 = 10091110

Part 3 of 3: Hexadecimal number system

  1. 1 Learn how to use the hexadecimal system. We usually use the ten-digit decimal system. The hexadecimal system uses sixteen characters, including both numbers and letters.
    • Here are the numbers starting at zero:
      Hexadecimal Decimal Hexadecimal Decimal
      001016
      111117
      221218
      331319
      441420
      551521
      661622
      771723
      881824
      991925
      A101A26
      B111B27
      C121C28
      D131D29
      E141E30
      F151F31
  2. 2 Use a subscript to show which system you are using. A decimal number is used for this. For example 1710 - this is the number 17 in decimal system (that is, the usual decimal number 17); eleven10 = 1016, that is, decimal 11 is equal to 10 in hexadecimal. Hexadecimal numbers do not always include a letter. But if instead of a number you write a letter, then it is clear that this is a hexadecimal system.

Tips

  • Use an online calculator when converting large hexadecimal numbers. You may not bother yourself at all and use an online converter, but it is still a good idea to understand the manual calculations in order to understand the process properly.
  • The hex to decimal conversion algorithm is suitable for converting any number system to decimal numbers. Just replace the number 16 (in some powers) with the corresponding number (in some powers) of another number system.