Network Addressing

IPv4 to integer

Direction
IPv4 address
Integer 3232235777
Four octets packed into 32 bits
Hexadecimal 0xC0A80101
Binary, by octet 11000000 10101000 00000001 00000001
Address 192.168.1.1
Note
32 bits · max 4294967295

An IPv4 address is genuinely a 32-bit integer; the dots are a display convention. Storing it as an integer makes range queries trivial — a subnet is a contiguous span of integers, so "is this address in this network" becomes a simple comparison rather than string parsing. It is why databases handling IP data almost always store the integer form.

Advertisement
320 × 100

An IPv4 address is four bytes packed into a 32-bit integer. 192.168.1.1 becomes 3232235777 — that is 192×2²⁴ + 168×2¹⁶ + 1×2⁸ + 1. The dots are presentation, not structure.

How to convert an IP to an integer

1 Enter the dotted-quad address.
2 Read the integer, hex and binary forms.
3 Switch direction to convert an integer back.
4 An octet above 255 is rejected, since it cannot fit in a byte.

The integer form makes subnet arithmetic straightforward. A /24 network is 256 consecutive integers, so checking membership is a range comparison rather than mask manipulation on strings. It also sorts correctly, which dotted-quad strings emphatically do not — sorted as text, 10.0.0.9 comes after 10.0.0.10. Any system storing addresses for querying benefits from the integer.

Questions

3232235777.

Advertisement
300 × 250
Was this tool any good?
INTERNAL SIGNAL ONLY · WE USE IT TO FIND TOOLS WORTH REBUILDING