IP to Number

What is IP to Number?

IP to Number converts an IP address into a decimal number, commonly used in database field design where standard IP format needs to be converted into a decimal number. This conversion must follow the following algorithm:

  1. The first octet (leftmost) must be multiplied by 16777216 (256^3).
  2. The second octet must be multiplied by 65536 (256^2).
  3. The third octet must be multiplied by 256.
  4. All obtained values, including the fourth octet, must be summed (formally, the fourth octet must be multiplied by 256^0, i.e., by one).