In IPv4, addresses are 32-bit binary numbers. However, for ease of use by people, binary patterns representing IPv4 addresses are expressed as dotted decimals. This is first accomplished by separating each byte (8 bits) of the 32-bit binary pattern, called an octet, with a dot. It is called an octet because each decimal number represents one byte or 8 bits.
The binary address:
11000000 10101000 00001010 00001010
is expressed in dotted decimal as:
In Figure 1, select each button to see how the 32-bit binary address is represented in dotted decimal octets.
But how are the actual decimal equivalents determined?
Binary Numbering System
In the binary numbering system, the radix is 2. Therefore, each position represents increasing powers of 2. In 8-bit binary numbers, the positions represent these quantities:
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
128 64 32 16 8 4 2 1
The base 2 numbering system only has two digits: 0 and 1.
When we interpret a byte as a decimal number, we have the quantity that position represents if the digit is a 1 and we do not have that quantity if the digit is a 0, as shown in Figure 1.
Figure 2 illustrates the representation of the decimal number 192 in binary. A 1 in a certain position means we add that value to the total. A 0 means we do not add that value. The binary number 11000000 has a 1 in the 2^7 position (decimal value 128) and a 1 in the 2^6 position (decimal value 64). The remaining bits are all 0 so we do not add the corresponding decimal values. The result of adding 128+64 is 192, the decimal equivalent of 11000000.
Here are two more examples:
Example 1: An octet containing all 1s: 11111111
A 1 in each position means that we add the value for that position to the total. All 1s means that the values of every position are included in the total, therefore, the value of all 1s in an octet is 255.
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255
Example 2: An octet containing all 0s: 00000000
A 0 in each position indicates that the value for that position is not included in the total. A 0 in every position yields a total of 0.
0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 = 0
A different combination of ones and zeros will yield a different decimal value.