3 Ways to Convert Hexadecimal To Binary or Decimal

Table of contents:

3 Ways to Convert Hexadecimal To Binary or Decimal
3 Ways to Convert Hexadecimal To Binary or Decimal

Video: 3 Ways to Convert Hexadecimal To Binary or Decimal

Video: 3 Ways to Convert Hexadecimal To Binary or Decimal
Video: Introduction to Creating Flowcharts 2024, December
Anonim

How do you turn those funny numbers and letters into something you or your computer can understand? Converting hexadecimal to binary is very easy, which is the reason hexadecimal has been adopted in several programming languages. Converting to decimal is a bit more complicated, but once you get the hang of it, it's easy to repeat any number.

Step

Method 1 of 3: Converting Hexadecimal To Binary

Step 1. Convert each hexadecimal digit to four binary digits

Hexadecimal was initially adopted because it was very easy to convert between hexadecimal and binary. In essence, hexadecimal is used as a way to display binary information in shorter sequences. This table will help you to convert from one to the other:

Hexadecimal Binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111

Step 2. Try it yourself

This is as simple as converting a digit to its four binary equivalent digits. Here are some hex numbers you'll want to convert. Block the invisible text to the right of the equals sign to check your work:

  • A23 = 1010 0010 0011
  • BEE = 1011 1110 1110
  • 70C558 = 0111 0000 1100 0101 0101 1000

Step 3. Understand how it works

In the base two binary system, the binary digit n can be used to represent 2 n different numbers. For example, with four binary digits, you can represent 24 = 16 different numbers. Since hexadecimal is a base sixteen system, a single digit number can be used to represent 161 = 16 different numbers. This makes conversion between the two systems very easy.

You can also think of it as a system of calculations being flipped into other digits at the same time. Hexadecimal counts …D, E, F, 10'', at the same time, binary counts 1101, 1110, 1111, 10000''.

Method 2 of 3: Converting Hexadecimal To Decimal

1797961 6 1
1797961 6 1

Step 1. Review how base ten works

You use decimal notation every day without having to stop and think about what it means. However, when you first learn it, your parents or teachers may have explained it to you in more detail. A quick review on how to write ordinary numbers, will help you convert the numbers:

  • Each digit in a decimal number is located in a specific place. From left to right, there are ones places, tens places, hundreds places, and so on. The digit 3 only means 3 if it is in the ones place, but represents 30 when it is in the tens place, and 300 in the hundreds place.
  • Mathematically, the place represents 100, 101, 102, and then. This is why this system is called base ten, or decimal from the Latin word for tenth.
1797961 7 1
1797961 7 1

Step 2. Write down the decimal number as an addition problem

This may seem obvious, but it's the same process we'll use to convert hexadecimal numbers, so it's a good starting point. Let's rewrite the number 480.13710. (Remember, subscript 10 tells us that the number is written in base ten.):

  • Starting from the rightmost digit, 7 = 7 x 100, or 7 x 1
  • To the left, 3 = 3 x 101, or 3 x 10
  • Repeating all the digits, we get 480,137 = 4x100,000 + 8x10,000 + 0x1,000 + 1x100 + 3x10 + 7x1.
1797961 8 1
1797961 8 1

Step 3. Write the place value next to the hexadecimal number

Since hexadecimal is base sixteen, the place value corresponds to the power of sixteen. To convert to decimal, multiply each place value by the corresponding sixteenth digit. Begin this process by writing the power of sixteen next to the digits of the hexadecimal number. We will do this for the hexadecimal number C92116. Start on the left with 160, and increase the power each time you move left to the next digit:

  • 116 = 1 x 160 = 1 x 1 (All numbers are in decimal unless otherwise noted.)
  • 216 = 2 x 161 = 2 x 16
  • 916 = 9 x 162 = 9 x 256
  • C = C x 163 = C x 4096
1797961 9 1
1797961 9 1

Step 4. Convert alphabetic characters to decimal

The digits of a number are the same in decimal or hexadecimal, so you don't need to change them (for example, 716 = 710). For alphabetic characters, refer to this list to convert them to their decimal equivalents:

  • A = 10
  • B = 11
  • C = 12 (We'll be using this in our example above.)
  • D = 13
  • E = 14
  • F = 15
1797961 10 1
1797961 10 1

Step 5. Perform calculations

Now that everything is written in decimal, do each multiplication problem and add up the results. The calculator can help for most hexadecimal numbers. Continuing our previous example, here's C921 written as a decimal formula and solved:

  • C92116 = (in decimal) (1 x 1) + (2 x 16) + (9 x 256) + (12 x 4096)
  • = 1 + 32 + 2.304 + 49.152.
  • = 51.48910. The decimal version usually has more digits than the hexadecimal version, because hexadecimal can store more information in each digit.
1797961 11 1
1797961 11 1

Step 6. Practice converting

Here are some numbers to convert from hexadecimal to decimal. Once you've calculated the answer, block the invisible text to the right of the equals sign to check your work:

  • 3AB16 = 93910
  • A1A116 = 4137710
  • 500016 = 2048010
  • 500D16 = 2049310
  • 18A2F16 = 10091110

Method 3 of 3: Understanding Hexadecimal Basics

1797961 1
1797961 1

Step 1. Know how to use hexadecimal

Our regular decimal calculation system is based on ten, using ten different symbols to represent numbers. Hexadecimal is a base sixteen number system, meaning it uses sixteen characters to represent numbers.

  • Counting from zero up:

    Hexadecimal Decimal Hexadecimal Decimal
    0 0 10 16
    1 1 11 17
    2 2 12 18
    3 3 13 19
    4 4 14 20
    5 5 15 21
    6 6 16 22
    7 7 17 23
    8 8 18 24
    9 9 19 25
    A 10 1A 26
    B 11 1B 27
    C 12 1C 28
    D 13 1D 29
    E 14 1E 30
    F 15 1F 31
1797961 2
1797961 2

Step 2. Use a subscript to indicate the system you are using

If the system you are using is not clear, use a decimal subscript number to indicate the base. For example, 1710 means seventeen base ten (ordinary decimal number). 1110 = 1016, because 10 is how you write the number eleven in hexadecimal (base sixteen). You can skip this step if the number contains an alphabetic character such as B or E. No one will mistake it for a decimal number.

Tips

  • Long hexadecimal numbers may require an online calculator to convert to decimal. You can also skip this work and use an online conversion tool to do it, though it's a good idea to understand how the process works.
  • You can customize the hexadecimal to decimal conversion to convert any other x-based number system to decimal. Just replace the power of sixteen with the power of x. Try learning the 60-based Babylonian calculation system!

Recommended: