How to Convert IP Addresses to Binary Code

When you see an IP address in decimal format (for example, 123.45.67.89), you are seeing a decimal representation of the binary code that the computer uses. Each IP address is a 32-bit binary number, with each of the four decimal numbers represented by eight ones and zeros. You can convert an IP address to binary code with some simple arithmetic.

Instructions

    • 1

      Subtract 128 from the first decimal number in the IP address. If the result is less than zero, write a zero, otherwise write a one and keep track of the remainder of the subtraction.

    • 2

      Perform the same procedure using the remainder from Step 1, but use 64 instead of 128. Write the zero or one to the right of the zero or one you wrote in Step 1.

    • 3

      Repeat Step 2 using 32, 16, 8, 4, 2 and 1 each in place of 64, and write the ones or zeros in accordance with the results. You will get an eight-bit binary number.

    • 4

      Do Steps 1 through 3 with the other three IP address numbers, in order, until you have a 32-bit representation of the address. For the example IP address 123.45.67.89, the binary version is 01111011.00101101.01000011.01011001.

Tips & Warnings

  • You don't need to do the subtraction in Step 1 if the binary value (1, 2, 4, 8, etc.) that you are comparing is greater than the decimal value from the IP address. Simply write a zero if the binary value is greater than the decimal value.

  • When a computer sends a binary IP address, it doesn't include any periods. The number is just a sequence of 32 ones and zeros.

Related Searches:

Comments

You May Also Like

Related Ads

Featured