IP to Integer
Convert an IPv4 address to its 32-bit unsigned integer form — and back. Useful for compact database columns (4 bytes instead of 15), indexed range queries, and reasoning about netmasks. Hex and binary forms are shown alongside.
Same address, six representations
An IPv4 address is just 32 bits. The dotted form is for humans; integer, hex, and binary are for databases and routing tables.
Dotted: 192.168.1.1 Integer: 3,232,235,777 Hex: 0xC0A80101 Binary: 11000000.10101000.00000001.00000001 Octal: 030052000401 IPv6: ::ffff:192.168.1.1
SELECT * FROM logs
WHERE ip BETWEEN ipToInt('10.0.0.0')
AND ipToInt('10.255.255.255')
→ Single integer comparison
→ Indexable
→ ~4 bytes vs 15 for stringWhat you'll use this for
UUIDs are the universal "give me a unique identifier" tool — no central coordination required.
Compact storage
Store IPs as a 4-byte INT in your DB. Saves space and speeds up range queries.
Log analysis
Convert dotted IPs to integers to do range BETWEEN queries against subnet boundaries.
Subnet math
Hex and binary forms show subnet bits clearly — the boundary stands out visually.
Dual-stack work
IPv6-mapped form (::ffff:1.2.3.4) lets IPv6 sockets carry IPv4 packets.
How to convert an IP address
Type the IP
Enter dotted-decimal (192.168.1.1) — or paste a decimal integer below.
Hit Convert
Or just keep typing — the other forms update automatically as soon as the input is valid.
Read the results
Integer, hex, binary, octal, and IPv6-mapped notation all appear on the right.
Copy what you need
Click any value to copy it (or use the Copy button to grab all formats).
Frequently asked questions
For a.b.c.d: (a × 16777216) + (b × 65536) + (c × 256) + d. Equivalent in bit-shift form: (a<<24) | (b<<16) | (c<<8) | d. The result ranges 0 to 4,294,967,295.
This tool returns the standard unsigned form (0 to 4,294,967,295). MySQL's INET_ATON is unsigned; PHP's ip2long() historically returned signed on 32-bit systems (negative values for IPs ≥ 128.0.0.0).
Big-endian (network byte order). The first octet is the most significant byte. This matches MySQL, Postgres inet, and most network libraries.
Compact (4 bytes vs ~15), indexable, and trivially supports BETWEEN-range queries against subnet boundaries. The downside: less readable in raw query output — keep a view that emits dotted form.
Yes. No signup, no limits, no ads. Conversion happens entirely in your browser.
About IPv4 address formats
An IPv4 address is a 32-bit identifier. Each of the four octets in the dotted form is one byte (0–255). The same 32 bits can be expressed in any base.
Formats
- Dotted-decimal —
192.168.1.1, the human form. - Decimal integer —
3232235777, useful for DB storage. - Hex —
0xC0A80101, common in firewall configs. - Binary —
11000000.10101000.00000001.00000001, shows netmask bits. - IPv6-mapped —
::ffff:192.168.1.1, dual-stack representation.
Conversion math
- To integer:
(a<<24) | (b<<16) | (c<<8) | d - From integer: extract each byte with
(n >>> (24-8k)) & 0xff.