IP online converter

🖥 IP online converter

What is IP conversion?

IP addresses and Int addresses can be converted to each other. An IPv4 address is a 32-bit binary number, typically expressed as a.b.c.d in the rule of "dotted decimal". An Int address is an integer. That is the digital form of an IP address. It refers to the digital geographical location of a certain place on the international digital address network.

What is the purpose of doing IP conversion?

As we mentioned earlier, an IPv4 address is a 32-bit binary number. If it is represented by string type, it will occupy 7-15 bytes to store. For example, 0.0.0.0 requires 7 bytes, and 255.255.255.255 requires 15 bytes, which takes up a lot of space. And an Int number is just 4 bytes and 32 bits, so an Int number can be used to represent an IPv4 address, thereby greatly saving storage space.

How to do IP conversion?

Each segment of an IPv4 address can be regarded as an integer of 0-255. You can first split each segment into a binary and combine them. And then convert the binary number into a long integer.

Here take IP 10.0.3.193 as an example.

Segment Binary
10 00001010
0 00000000
3 00000011
193 11000001

The combination is 00001010 00000000 00000011 11000001. The decimal number is 167773121. So 167773121 is the Int number of the IPv4 address 10.0.3.193. You can also have a try through the following IP online converter.

📚 Comment

Languages