IPv4 to Integer Converter
Convert IPv4 addresses to their 32-bit integer representation and back. Useful for database storage, IP range comparisons, and network programming.
192.168.1.1 →
Decimal (unsigned)
3232235777
Hexadecimal
0xC0A80101
Binary (octets)
11000000.10101000.00000001.00000001
Class
Class C
Private range
192.168.0.0/16 (RFC 1918)
How to Use IPv4 to Integer Converter
- 1Enter an IPv4 address (e.g., 192.168.1.1) or a 32-bit integer.
- 2View the conversion in decimal, hexadecimal, binary, and CIDR forms.
- 3Use the result for database IP storage or network range calculations.
Zenovay
Track your website performance
Real-time analytics, session replay, heatmaps, and AI insights. 2-minute setup, privacy-first.
Related Tools
JSON Formatter & ValidatorFormat, validate, and beautify JSON data with syntax highlighting and error detection.
JWT DecoderDecode and inspect JWT tokens. View header, payload, and verify signatures.
Base64 Encode/DecodeEncode text to Base64 or decode Base64 back to text. Supports UTF-8 and binary data.
URL Encode/DecodeEncode or decode URL components. Handle special characters, query strings, and full URLs.
Frequently Asked Questions
How is an IPv4 address converted to a 32-bit integer?▾
An IPv4 address is 4 octets (bytes) separated by dots: A.B.C.D. Each octet ranges from 0 to 255. The 32-bit integer = A × 16,777,216 + B × 65,536 + C × 256 + D, or equivalently: (A << 24) | (B << 16) | (C << 8) | D. Example: 192.168.1.1 = 192×16,777,216 + 168×65,536 + 1×256 + 1 = 3,232,235,777. In hexadecimal: C0A80101. The reverse: divide the integer by successive powers of 256 and take remainders.
Why would you store IP addresses as integers?▾
Integer storage advantages: 4 bytes vs 15+ bytes for string format — saves space in large tables. Comparison is exact and fast (integer equality vs string parsing). Range queries are trivial: WHERE ip_int BETWEEN start_int AND end_int — no string parsing needed. Useful for IP blacklist lookup, geolocation, and access control. In MySQL, use INT UNSIGNED (0 to 4,294,967,295) with INET_ATON() / INET_NTOA() functions. PostgreSQL has native inet and cidr types that handle this automatically.
What is the difference between signed and unsigned 32-bit integers for IPs?▾
IPv4 integers range from 0 to 4,294,967,295 (2^32 − 1). Unsigned 32-bit (uint32): 0 to 4,294,967,295 — fits all IPv4 addresses. Signed 32-bit (int32): −2,147,483,648 to 2,147,483,647 — IPs above 128.0.0.0 become negative! Example: 192.168.1.1 = 3,232,235,777 overflows signed int32 → stored as −1,062,731,519. Always use UNSIGNED INT in MySQL for IP storage. In Java and C#, use uint or long. In Python, integers are arbitrary precision so no overflow.
How do IP addresses map to classes and private ranges?▾
IPv4 class system (legacy): Class A: 0.0.0.0–127.255.255.255 (0x00000000–0x7FFFFFFF). Class B: 128.0.0.0–191.255.255.255. Class C: 192.0.0.0–223.255.255.255. Private RFC 1918 ranges: 10.0.0.0/8 (10.x.x.x, large corporate networks), 172.16.0.0/12 (172.16.x.x to 172.31.x.x), 192.168.0.0/16 (192.168.x.x, home/small office). Loopback: 127.0.0.0/8. APIPA/link-local: 169.254.0.0/16. Multicast: 224.0.0.0/4.
What are special IPv4 addresses and ranges?▾
Reserved IPv4 ranges: 0.0.0.0/8: "this" network, used as source when address unknown. 127.0.0.0/8: loopback (localhost = 127.0.0.1). 169.254.0.0/16: APIPA/link-local, auto-assigned when DHCP fails. 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24: documentation/example ranges. 224.0.0.0/4: multicast. 240.0.0.0/4: reserved. 255.255.255.255: broadcast. In CIDR notation, /32 is a single host, /0 is all addresses. The last usable address in a subnet is always 1 less than the broadcast address.