Conversion Between Decimal Numbers and Binary


In the given octet of an IP address, the 8 bits can be defined as follows:


27
26
25
24
23
22
21
20
128
64
32
16
8
4
2
1




For convert a decimal number into binary, you must turn on the bits (make them a 1) that would add up to that number, as follows:
188 = 10111100 = 128+32+16+8+4
224 = 11100000 = 128+64+32


To convert a binary number into decimal, we must add the bits that have been turned on (the 1s), as follows:
10101010 = 128+32+8+2 = 170
11110000 = 128+64+32+16 = 240

The IP address 192.168.100.1 is represented in binary as 
11000000.10101000.01100100 .00000001


The subnet mask of 255.255.255.128 is represented in binary as

 11111111.11111111.11111111.1 0000000



No comments