IPv4 to Integer
Convert an IPv4 address into the single 32-bit number it represents.
Jump to toolWhat Is IPv4 to Integer Conversion?
Every IPv4 address is really a single 32-bit number; the dotted form, such as 192.168.1.1, is that number split into four bytes. Converting it to the integer form, 3232235777 for that address, makes addresses easy to store in databases and to compare or sort as ranges.
Enter an IPv4 address and the tool combines its four octets into the equivalent unsigned 32-bit integer.
How to Convert an IP to an Integer
- Enter an IPv4 address such as 192.168.1.1.
- Select Calculate.
- Copy the integer, 3232235777 in this example, into your database or script.
The Formula
Multiply each octet by its place value and add them up: first × 16,777,216 + second × 65,536 + third × 256 + fourth.
For 192.168.1.1: 192 × 16,777,216 + 168 × 65,536 + 1 × 256 + 1 = 3,232,235,777.
Examples
| IPv4 address | Integer |
|---|---|
| 0.0.0.0 | 0 |
| 8.8.8.8 | 134744072 |
| 10.0.0.1 | 167772161 |
| 192.168.1.1 | 3232235777 |
| 255.255.255.255 | 4294967295 |
Why Store Addresses as Integers
- They take 4 bytes instead of up to 15 characters.
- Range checks become simple comparisons: start ≤ address ≤ end.
- Geolocation and blocklist databases are usually indexed this way.
- MySQL's INET_ATON() and INET_NTOA() functions convert in both directions.
IPv4 to Integer FAQ
Going the other way?
Turn an integer back into a dotted IPv4 address.
Related Tools
Tools that often come next after this one