How to manually convert an IP address to binary

For IP Address: 182.167.10.48 the complete binary value is:

10110110.10100111.00001010.00110000

Each decimal number in an IP address is represented at a binary octet (8 binary digits). Using the table below for each decimal in the IP address complete the following steps:

Step 1: Start by writing the first number in the IP address (182) in the Decimal column. Divide the Decimal value (182) by 2. Write the dividend (91) in the /2 column. If 2 divides evenly into the first number (i.e., there is no remainder) write a 0 in the Remainder column.

Step 2: Write the dividend from the first row (91) in the Decimal column of the next row. Divide the Decimal value (91) by 2. Write the dividend (45) in the /2 column. Here, there is a remainder of 1. Write a 1 in the Remainder column.

Step 3: Continue this process until you reach the last decimal value.

Step 4: Order the Remainder’s from bottom to top. The binary code for the number 182 is 10110110.

Decimal /2 Remainder
182 91 0
91 45 1
45 22 1
22 11 0
11 5 1
5 2 1
2 1 0
1 0 1

Repeat this process for each decimal number in the IP address.

IP Address: 182.167.10.48

The binary code for 167 is 10100111.

Decimal /2 Remainder
167 83 1
83 41 1
41 20 1
20 10 0
10 5 0
5 2 1
2 1 0
1 0 1

IP Address: 182.167.10.48

The binary code for 10 is 00001010.

Note using the table to identify the binary number for 10 only results in 4 numbers in the Remainder column. In the event that the Remainder column contains less than 8 digits, fill in the remaining place values in the octet with 0’s. These 0’s should precede the digits in the Remainder column. Here fill in four 0’s prior to the Remainder digits 1010.

Decimal /2 Remainder
10 5 0
5 2 1
2 1 0
1 0 1

IP Address: 182.167.10.48

The binary code for 48 is 00110000.

Note here fill in two 0’s before the Remainder digits 110000.

Decimal /2 Remainder
48 24 0
24 12 0
12 6 0
6 3 0
3 1 1
1 0 1

The complete binary value for the IP address 182.167.10.48 is:

10110110.10100111.00001010.00110000

 
7
Kudos
 
7
Kudos

Now read this

How to convert a Unix timestamp to POSIXct in R (i.e. 1532289300 = 2018-07-22 19:55:00)

If you are converting a column of Unix timestamps in a dataframe: > df$Your.Times <- as.POSIXct(df$Your.Times, origin = “1970-1-1”) [1] [POSIXct datetimes] … or … If you are converting a single Unix timestamp: > yourtime =... Continue →