IP Octet, Binary and Decimal Calculators.
IPv4 Address Tutorial: Converting Octets to Binary and Decimal
IPv4 is a 32 bit addressing system represented by four 8-bit numbers.
*Add this page to your favorites*
Each octet is separated by a period and can display any number from 0 to 255; thus each Octet can represent up to 256 different values. These values are based on a binary system (powers of 2) translated into decimal form. The available number of IP Addresses in IPv4 is represented as 232 or 2564 (256*256*256*256), which allows for the possibility of 4,294,967,296 addresses. This tutorial will enable you to easily convert IP addresses into binary octets and full decimal representations and back again.
An IPv4 IP address can be numerically represented in three different ways:
- Decimal Octets
- Binary Octets
- Decimal Address
Humans are most familiar with the Decimal Octet form. For example, msn.com (as of the writing of this article), could be represented with IP address 207.68.172.246. But machines interpret numbers in binary. The binary representation of 207.68.172.246 is 11001111.01000100.10101100.11110110. Looking at the possible 4,294,967,296 IPv4 addresses, 207.68.172.246 could be represented in full decimal as address 3,477,384,438. In fact, you could access the msn.com page using the full decimal address http://3477384438/.
To better understand and work with IP addressing it is important to know how to use binary numbers to represent network and address space.
Each octet in an address is represented by an 8-bit number.
To represent the potential range of an octet we could use the chart below to show the eight available bits and the associated decimal value of an active bit (bit turned on).
| Power of 2: | 27 | 26 | 25 | 24 | 23 |
22 | 21 | 20 |
| Bit: | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
| On/Off Status: | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| Decimal Octet Value: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| Decimal Value: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
To determine the value of the above binary octet (.11111111) all we need to do is add up the value Decimal Octet Value of the bits that are turned on (a value of 1). In this case all the bits are turned on so we would add 128+64+32+16+8+4+2+1 and get a value of 255. In order to get convert this binary octet into Decimal we would simply add the Decimal value of the powers of 2 on the active bits. For the first Octet this is easy as the Decimal value is equivalent to the the Decimal Octet Value. This will not be the case with the three octets to the left of this one.
Let's follow this principle using all four 8-bit octets in the msn.com IP address in the full 32 bit conversion chart below
IP |
Bit | ^2 | Decimal value of bit | Octet Value | Bit status | Decimal |
|
207 |
32 |
231 |
2,147,483,648 |
128 |
1 |
2,147,483,648 |
31 |
230 |
1,073,741,824 |
64 |
1 |
1,073,741,824 |
30 |
229 |
536,870,912 |
32 |
0 |
0 |
29 |
228 |
268,435,456 |
16 |
0 |
0 |
28 |
227 |
134,217,728 |
8 |
1 |
134,217,728 |
27 |
226 |
67,108,864 |
4 |
1 |
67,108,864 |
26 |
225 |
33,554,432 |
2 |
1 |
33,554,432 |
25 |
224 |
16,777,216 |
1 |
1 |
16,777,216 |
|
68 |
24 |
223 |
8,388,608 |
128 |
0 |
0 |
23 |
222 |
4,194,304 |
64 |
1 |
4,194,304 |
22 |
221 |
2,097,152 |
32 |
0 |
0 |
21 |
220 |
1,048,576 |
16 |
0 |
0 |
20 |
219 |
524,288 |
8 |
0 |
0 |
19 |
218 |
262,144 |
4 |
1 |
262,144 |
18 |
217 |
131,072 |
2 |
0 |
0 |
17 |
216 |
65,536 |
1 |
0 |
0 |
|
172 |
16 |
215 |
32,768 |
128 |
1 |
32,768 |
15 |
214 |
16,384 |
64 |
0 |
0 |
14 |
213 |
8,192 |
32 |
1 |
8,192 |
13 |
212 |
4,096 |
16 |
0 |
0 |
12 |
211 |
2048 |
8 |
1 |
2,048 |
11 |
210 |
1024 |
4 |
1 |
1,024 |
10 |
29 |
512 |
2 |
0 |
0 |
9 |
28 |
256 |
1 |
0 |
0 |
|
246 |
8 |
27 |
128 |
128 |
1 |
128 |
7 |
26 |
64 |
64 |
1 |
64 |
6 |
25 |
32 |
32 |
1 |
32 |
5 |
24 |
16 |
16 |
1 |
16 |
4 |
23 |
8 |
8 |
0 |
0 |
3 |
22 |
3 |
4 |
1 |
4 |
2 |
21 |
2 |
2 |
1 |
2 |
1 |
20 |
1 |
1 |
0 |
0 |
|
|
Binary Conversion: 11001111.01000100.10101100.11110110 Decimal Conversion: 3477384438 |
The coversion chart shows the activated bits (1) in the Bit Status column. To view the IP address in binary octets Start with bit the far left octet (207) and horizontally view the octet.
207 = 11001111.
68 = 01000100.
72 = 10101100.
46 = 11110110
Binary Conversion: 11001111.01000100.10101100.11110110
Converting from binary to decimal is as simple as looking at the activated bits (1) in the bit status column and adding the corresponding decimal value in the Decimal column. Let's obtain the decimal values for the same four 8-bit octets.
207 = 3472883712
68 = 4456448
72 = 44032
46 = 246
Decimal total: 3477384438
This should give you an excellent understanding of IPv4 to binary and decimal.
To experiment with your own IP Addresses try our IPv4 addresses - Converting Octets to Binary and Decimal Calculator.
Good luck! Don't forget to Add this page to your favorites.
|