IP2Long Converter

Convert IPv4 addresses such as 192.168.1.1 to their 32-bit integer representation, with hex and binary shown alongside.

  • Runs in your browser
  • Free, no sign-up

One IPv4 address per line.

Ctrl + Enter also runs the tool

What this tool gives you

Decimal, hex and binary

Three representations of each address in one table.

Bulk conversion

Paste hundreds of addresses; invalid lines are flagged, not skipped silently.

Plain list output

A second block with only the integers, ready for a database query.

Frequently asked questions

What is ip2long used for?

Storing IPv4 addresses as integers makes range queries fast: checking whether an address falls between two numbers is cheaper than comparing strings.

Why does PHP sometimes return a negative number?

On 32-bit builds PHP ip2long() returns a signed integer. This tool always shows the unsigned value, which is what sprintf("%u") produces.

Does it support IPv6?

No. IPv6 addresses are 128-bit numbers that do not fit a long; use a dedicated library or store them as binary(16) in your database.

How is the number calculated?

Each octet is a byte: first × 16777216 + second × 65536 + third × 256 + fourth. For 1.2.3.4 that gives 16909060.

From APIVoid

Need security checks inside your own product?

APIVoid turns the lookups you run here into developer-friendly JSON APIs: IP reputation, URL status and redirects, DNS lookups, SSL info, domain age, screenshots and much more. Simple pricing, 30-day free trial.