Format Code Now
/
ConvertIP to Decimal Next: CIDR Calculator ›

IP to Decimal Converter

CV-24

Paste an IPv4 address such as 192.168.1.1 and get its 32-bit integer, 3232235777. Use the other button to turn integers back into dotted addresses, one per line.

Runs in your browser. Nothing is uploaded.

IPv4 addresses or 32-bit integers (one per line)

Result

How to use it

  1. Paste one IPv4 address per line, or one integer per line for the reverse direction.
  2. Click IP to decimal to get the integer for each address.
  3. Click Decimal to IP to turn integers from 0 to 4294967295 back into dotted addresses.
  4. Check the output. An invalid line gives an error that quotes the value.
  5. Copy the result or download it as a text file.

How the number is worked out

An IPv4 address is four bytes. The integer is the first number times 16777216, plus the second times 65536, plus the third times 256, plus the fourth. For 192.168.1.1 that is 3232235777. The first number is the most significant byte, which is the usual network byte order. The largest address, 255.255.255.255, is 4294967295, and the smallest is 0.

Where the integer form is used

Databases and log tools sometimes store IPv4 addresses as unsigned 32-bit integers, because an integer column is smaller and easier to compare than text. Range checks then become simple comparisons: an address is inside a block if its integer lies between the block's first and last integers. Some systems use a signed integer or reverse the byte order, and this page does neither.

Limits

Only IPv4 is supported, with no ports, prefixes or IPv6. Addresses need exactly four numbers from 0 to 255, and numbers with a leading zero such as 010 are rejected, because some systems read them as octal. Integers must be whole numbers from 0 to 4294967295 with no commas or spaces.

Error messages and what to do

MessageWhat it meansFix
"4294967296" is not a whole number from 0 to 4294967295.The integer is too large for 32 bits.Use a value up to 4294967295, which is 255.255.255.255.
Octet 300 in "300.1.1.1" is above 255.One of the four numbers is above 255.Use values from 0 to 255 in each position.
"10.0.1" is not an IPv4 address. Expected 4 numbers separated by dots, such as 192.168.1.1.The address does not have exactly four parts.Add the missing numbers, for example 10.0.1.0.

Questions people ask

How do I convert an IP address to a decimal number?

Multiply the first number by 16777216, the second by 65536, the third by 256 and add the fourth. Or paste the address into the box and click IP to decimal. 10.0.0.1 gives 167772161.

How do I convert a decimal number back to an IP address?

Click Decimal to IP and paste the integer. 3232235777 becomes 192.168.1.1. The number must be between 0 and 4294967295, because an IPv4 address has 32 bits.

What is 255.255.255.255 as an integer?

4294967295, which is 2 to the power of 32 minus 1. It is the largest value an IPv4 address can have, and 0.0.0.0 is the smallest, at 0.

Why store IP addresses as integers?

A 32-bit integer takes less space than the text form and compares quickly, which suits range lookups and sorting. Text is easier to read, so many people keep both and convert as needed.

Does it reverse the byte order?

No. The first number is always the highest byte, which is network byte order. If your system stores the bytes the other way round, reverse the four numbers in the address before converting.

About this tool

Treats the four numbers of an IPv4 address as the bytes of one unsigned 32-bit integer, with the first number as the most significant byte (network order). So 192.168.1.1 is 3232235777. The integer must be from 0 to 4294967295. Numbers with a leading zero in an address are rejected. Some systems store the bytes the other way round (little-endian); this page does not reverse them. IPv4 only, no IPv6, ports or prefixes.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.