IPv4 to Integer Converter

Enter an IPv4 address or an integer and choose the conversion direction.

How it is calculated

Address to integer: for a.b.c.d the tool computes a × 16777216 + b × 65536 + c × 256 + d. Integer to address: a = floor(n / 16777216), then b, c and d are taken from the remainders after dividing by 65536 and 256. The hexadecimal result is the same number as eight hex digits, padded with zeros and prefixed with 0x.

The tool is strict: a dotted address needs exactly four decimal parts, each 0 to 255, and an integer must be plain digits from 0 to 4294967295. Anything else, including a number in the wrong direction mode, gives no result. Leading zeros are read as ordinary decimal (010 is ten, not octal eight). The integer is shown with thousands separators, but when converting back you must type it without them.

Worked example

Take 192.168.1.10 in address-to-integer mode. The four octets are weighted: 192 × 16777216 = 3,221,225,472; 168 × 65536 = 11,010,048; 1 × 256 = 256; and 10. Adding them gives 3,232,235,786. In hexadecimal, the octets 192, 168, 1 and 10 are C0, A8, 01 and 0A, so the tool also shows 0xC0A8010A. Switching to integer-to-address mode and entering 3232235786 returns 192.168.1.10 again.

Try this example →

Common mistakes

  • Leaving the mode on address-to-integer while typing a number (or the other way round). The input then does not match the expected format and nothing is returned.
  • Typing the integer with thousands separators such as 3,232,235,786. When converting to an address, only digits are accepted, so type 3232235786.
  • Entering an octet above 255 (for example 192.168.1.256) or fewer than four parts. Both are rejected rather than corrected.
  • Assuming leading zeros mean octal, as some older tools treat them. Here 010.000.000.001 is read as decimal 10.0.0.1 and gives 167,772,161.
  • Using the result for IPv6 or for a signed 32-bit field. This covers IPv4 only, and the integer is unsigned, so values above 2147483647 appear as large positive numbers.

About this calculator

An IPv4 address written in dotted-decimal form (like 192.168.1.1) is really a 32-bit unsigned integer split into four 8-bit octets. Converting to integer form multiplies each octet by its positional weight — 256³, 256², 256¹, and 256⁰ — and sums the results, giving a single number from 0 to 4,294,967,295; the reverse operation splits that integer back into four octets.

This calculator performs the conversion in either direction and also shows the hexadecimal representation, since IP addresses are frequently stored, sorted, and compared as plain integers or hex values in databases, firewall rules, and network logs rather than as strings.

Working with the integer form makes range checks and CIDR-block math (is address X within subnet Y?) a simple numeric comparison instead of parsing and comparing dotted strings, which is why network engineers and backend developers convert between the two formats regularly.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    For a subnet membership test, convert the first and last address of the block and compare. The range 192.168.1.0/24 runs from 3232235776 (192.168.1.0) to 3232236031 (192.168.1.255), so any address whose integer falls between those two numbers is inside it, such as 192.168.1.10 at 3232235786. The tool converts one value at a time and does not take a CIDR prefix. Where do you store addresses as integers: a database column, a log, or a firewall rule?

Popular calculators

All Calculators