Decimal to IP Converter
Convert a 32-bit decimal integer back into a dotted-decimal IPv4 address. Enter any value between 0 and 4,294,967,295 and the four octets are derived for you.
Dividing the number back into octets
The decimal form is a single number, so reversing it means extracting four bytes. Because each octet is eight bits, each one is a base-256 digit, and you extract them by repeated division — the same way you extract decimal digits from a number by dividing by 10.
3,232,235,777 ÷ 16,777,216 = 192 remainder 10,048,513
10,048,513 ÷ 65,536 = 168 remainder 65,281
65,281 ÷ 256 = 1 remainder 1
1 = 1
Octets: 192 . 168 . 1 . 1A faster route is to work in hexadecimal, since an address is always eight hex digits and each pair is one octet. 3,232,235,777 is C0A80101, which splits immediately into C0, A8, 01 and 01 — that is 192, 168, 1 and 1.
Worked example: a value above 2 billion
Values with the top bit set are where signed-integer implementations fail, so they are worth working through explicitly.
Example: 2,130,706,433
2,130,706,433 ÷ 16,777,216 = 127 remainder 2,650,401. Then 2,650,401 ÷ 65,536 = 40 remainder 24,961. Then 24,961 ÷ 256 = 97 remainder 129. And 129 is the last octet.
Result: 127.0.40.129
In hex this is 7F002881, and the leading 7F confirms the first octet is 127 — the loopback range. Note that 2,130,706,433 is well under 2^31 = 2,147,483,648, so this value happens to survive a signed 32-bit type. Anything at or above that threshold would not, which is why 127.255.255.255 is the last address that is safe in a signed int.
The boundary is worth remembering: exactly 2,147,483,647 converts to 127.255.255.255, and the very next integer, 2,147,483,648, is 128.0.0.0 — the first address that overflows a signed 32-bit integer.
Common mistakes
- Passing a negative number. Convert it back by adding 2^32 first, or use an unsigned type.
- Confusing decimal and octal. A leading zero in some languages makes a literal octal, so 3232235777 written with a leading zero is either an error or a completely different number depending on the runtime.
- Feeding in an IPv6 integer. A 39-digit value is 128 bits. There is no valid IPv4 interpretation of it, so the converter rejects anything above 4,294,967,295 rather than truncating silently.
- Assuming the value is an address when it is a mask. 4,294,967,295 converts to 255.255.255.255, which is the /32 mask as well as the broadcast address — the same number means different things depending on where it appears.
Also: IP to Decimal Converter · IP to Binary Converter · IP to Hex Converter · Hex to IP Converter · Binary to IP Converter
Reference: the shape of the address space
| Decimal | Address | Significance |
|---|---|---|
| 0 | 0.0.0.0 | Smallest value; unspecified address and default route |
| 1 | 0.0.0.1 | Second smallest value |
| 2,130,706,433 | 127.0.0.1 | Loopback address |
| 2,147,483,647 | 127.255.255.255 | Largest value safe in a signed 32-bit integer |
| 2,147,483,648 | 128.0.0.0 | First value that overflows a signed 32-bit integer |
| 2,886,729,728 | 172.16.0.0 | Start of the RFC 1918 172.16/12 block |
| 3,232,235,520 | 192.168.0.0 | Start of the RFC 1918 192.168/16 block |
| 3,232,235,777 | 192.168.1.1 | Common home gateway |
| 3,758,096,383 | 223.255.255.255 | Top of the unicast range |
| 3,758,096,384 | 224.0.0.0 | Start of multicast (class D) |
| 4,294,967,295 | 255.255.255.255 | Largest value; 2^32 − 1 |
The address space holds 2^32 = 4,294,967,296 values in total. The private ranges occupy 16,777,216 addresses in 10/8, 1,048,576 in 172.16/12 and 65,536 in 192.168/16 — together a little over 17.9 million, or roughly 0.4% of the total.
Reverse direction: IP to decimal. Related: hex to IP, binary to IP, subnet calculator.
Frequently asked questions
How do I convert a decimal number to an IP address?
Divide the number into four octets from the top down. The first octet is the integer part of the value divided by 16,777,216; subtract that product, then divide the remainder by 65,536 for the second octet, then by 256 for the third, and the final remainder is the fourth. For 3,232,235,777 that gives 192, 168, 1 and 1.
What is the valid range of decimal IP values?
0 to 4,294,967,295 inclusive. Zero is 0.0.0.0 and 4,294,967,295 is 255.255.255.255. The range has exactly 2^32 = 4,294,967,296 values, matching the number of possible IPv4 addresses.
Why do I get 0.0.0.0 for a value of 0?
Zero is a legitimate IPv4 address meaning 'this host' or, in routing tables, the default route 0.0.0.0/0. It is not routable as a destination on its own, but it is a valid value to convert.
Can this convert an IPv6 decimal value?
No. An IPv6 address is 128 bits, so its decimal form can be up to 39 digits and cannot be held in a 32-bit integer. If your value is longer than ten digits it is almost certainly an IPv6 integer — use the IPv6 calculator, which handles the full 128-bit range with arbitrary-precision arithmetic.
Why would an address be stored as a number at all?
Because integer comparison is fast and exact. A range check becomes two numeric comparisons, sorting is numerically correct, and the storage is a fixed four bytes rather than a variable-length string. Most large-scale log and analytics systems convert to integers at ingest time for exactly these reasons.
What if my number came out negative somewhere?
Add 4,294,967,296 to it. A negative value in the range -2,147,483,648 to -1 is the signed 32-bit representation of an address in the upper half of the address space, so -1,061,515,519 is 3,232,235,777, which is 192.168.1.1.