IPv4 Address Converter
Convert an IPv4 address to its 32-bit integer, hex and binary forms, or turn a decimal or 0x hex number back into dotted notation.
The interactive tool loads here when JavaScript runs.
About this toolWhat is the IPv4 Address Converter?
The IPv4 Address Converter turns a dotted address like 192.168.1.1 into the single 32-bit number it really is (3232235777), and shows the same value in hex (0xC0A80101) and in binary grouped by octet. The second card goes the other way: paste a decimal integer, or a hex value starting with 0x, and get the dotted address back.
Input is checked strictly. Octets above 255, letters, leading zeros and numbers above 4,294,967,295 are rejected with a message instead of being silently truncated or wrapped. All conversion happens in your browser.
- IPv4 to decimal integer, hex and dotted binary in one click
- Decimal or 0x hex back to dotted-decimal
- Strict validation: no octets above 255, no leading zeros, nothing above 2^32 - 1
- Reference values for 127.0.0.1, 192.168.1.1, 8.8.8.8 and 255.255.255.255
- Copy buttons and a Clear All reset; runs in your browser
Updated
How to use the IPv4 Address Converter
- In the IP to Decimal card, type an IPv4 address such as 10.0.0.1 into IP Address.
- Click Convert to Decimal. The result shows the decimal integer with hex and binary underneath.
- In the Decimal to IP card, enter a number such as 3232235777 or 0xC0A80101 and click Convert to IP.
- Copy any result with the copy button, or press Clear All to reset both cards.
Worked examples
Private address to integer
Input
192.168.1.1
Output
Decimal 3232235777, hex 0xC0A80101, binary 11000000.10101000.00000001.00000001
192 x 16,777,216 + 168 x 65,536 + 1 x 256 + 1 = 3,232,235,777. Each hex pair (C0, A8, 01, 01) is one octet.
Hex back to dotted form
Input
0x7F000001
Output
127.0.0.1
Hex 7F is 127. This is the form you see in packet dumps, /proc/net/tcp on Linux (in little-endian byte order there) and some log formats.
An out-of-range integer
Input
4294967296
Output
Error: value must be between 0 and 4294967295
That is 2^32, one more than the largest IPv4 address. A tool that wraps it to 0.0.0.0 would hide a data bug.
Background and insight
An IPv4 address is a 32-bit unsigned integer. The dotted-decimal form is just a human convention: each of the four numbers is one byte, so the integer value is a x 16,777,216 + b x 65,536 + c x 256 + d. That is why databases often store addresses as an unsigned INT, why MySQL has INET_ATON and INET_NTOA, and why range checks like "is this IP inside 10.0.0.0/8" become a simple numeric comparison.
Parsers disagree on unusual forms. The BSD inet_aton function accepts shorthand like 127.1 and treats a leading 0 as octal and 0x as hex, so 0177.0.0.1 is loopback to curl but an error in a strict parser. Those differences have caused real security bugs, including server-side request forgery filters that a hex or octal address slipped past. This converter accepts only plain dotted decimal on the IP side, and decimal or 0x hex on the integer side, so what you see is unambiguous.
Common use cases
Reading integer IPs in databases
Decode addresses stored as unsigned integers by INET_ATON or by an application that saves space with INT columns.
Writing range queries
Convert the first and last address of a block to integers to build a BETWEEN query or an index-friendly range check.
Packet and log analysis
Translate hex addresses from tcpdump output, kernel tables or binary protocols into readable dotted form.
Learning subnet maths
See the binary layout of an address to understand where a /20 or /26 boundary falls.
Tips and limitations
- If an integer looks negative in your database, it was stored in a signed 32-bit column. Add 4,294,967,296 to get the real value.
- The integer is in network byte order (big-endian). Values read from little-endian memory, such as Linux /proc/net/tcp, need their bytes reversed first.
- Shorthand like 127.1 and octal octets are rejected here even though curl and ping accept them. Write all four octets in decimal.
- This page handles IPv4 only. An IPv6 address is a 128-bit number and needs BigInt arithmetic.
Sources and further reading
- RFC 791: Internet Protocol, IETF. The 32-bit IPv4 address format
- inet(3): Linux manual page, The Linux man-pages project. How inet_aton accepts shorthand, octal and hex forms
Frequently asked questions
How do I convert an IP address to a decimal number?
Multiply the first octet by 16,777,216, the second by 65,536, the third by 256, and add the fourth. 192.168.1.1 becomes 3,232,235,777. The converter does this for you and also shows hex and binary.
What is the largest decimal value an IPv4 address can have?
The largest is 4,294,967,295, which is 255.255.255.255 or 2^32 minus 1. Anything larger is not an IPv4 address, and the converter reports an error instead of wrapping it around to 0.0.0.0.
Why does ping 3232235777 work in my terminal?
Most command-line tools pass the host through inet_aton, which accepts a bare 32-bit integer as an address. So ping 3232235777 pings 192.168.1.1. The same parser also accepts hex and octal forms.
Can I paste an IP address in hex?
Yes, in the Decimal to IP card. Prefix it with 0x, as in 0xC0A80101, and it converts to 192.168.1.1. The IP to Decimal card expects normal dotted decimal.
Why are leading zeros like 010.0.0.1 rejected?
They are ambiguous. inet_aton reads 010 as octal 8, while many other parsers read it as decimal 10. Python 3.9.5 and later reject leading zeros for the same reason, after it was flagged as a security issue.
How do I store IP addresses as integers in MySQL?
Use an INT UNSIGNED column with INET_ATON() on insert and INET_NTOA() on read. For IPv6 or mixed data, use VARBINARY(16) with INET6_ATON() and INET6_NTOA() instead.
Is there an in-depth guide to the IPv4 Address Converter?
Yes. “How Subnetting Works: CIDR Prefixes, Masks and Host Counts” covers the background, how it works, common pitfalls and worked examples. Read the full guide.
Related Tools You May Like
Free, in-browser tools that pair well with this one.