An IP address is just a number
An IPv4 address is a 32-bit number. The familiar form 192.168.1.1, called dotted decimal, splits those 32 bits into four 8-bit octets and writes each one in decimal. The same address can be written as one decimal integer, in binary, in hex or in octal, and software such as databases, firewalls, log files and network libraries often uses one of those forms. This converter reads any of them and shows all the others.
| Format | 192.168.1.1 written that way | Where you see it |
|---|---|---|
| Dotted decimal | 192.168.1.1 | Everywhere: settings, URLs, logs |
| Decimal integer | 3232235777 | Databases (e.g. storing IPs as unsigned int), GeoIP ranges |
| Binary (dotted) | 11000000.10101000.00000001.00000001 | Subnetting and networking courses |
| Hex | 0xC0A80101 or C0.A8.01.01 | Packet captures, memory dumps, some config files |
| Octal (dotted) | 0300.0250.0001.0001 | Legacy C functions such as inet_aton() |
| IPv4-mapped IPv6 | ::ffff:192.168.1.1 | Dual-stack servers logging IPv4 clients |
How to convert an IP address to decimal
Each octet is worth 256 times the one to its right, so the formula is a × 16,777,216 + b × 65,536 + c × 256 + d (those are 2563, 2562 and 256). For 192.168.1.1:
192 × 16777216 + 168 × 65536 + 1 × 256 + 1 = 3221225472 + 11010048 + 256 + 1 = 3232235777
To go back from a decimal number to an IP, divide by 256 repeatedly and read the remainders from last to first, or divide by 16,777,216, 65,536 and 256 in turn. The largest IPv4 address, 255.255.255.255, is 4,294,967,295 (232 − 1), and 0.0.0.0 is 0.
IP to binary, hex and octal
Converting to binary is done one octet at a time: write each octet as exactly eight bits. 192 is 11000000, 168 is 10101000 and 1 is 00000001. Binary is the form that makes subnet masks readable: a /24 mask is twenty-four 1s followed by eight 0s, which is 255.255.255.0. For hex, each octet becomes two hex digits (192 = C0, 168 = A8), and the four pairs joined give the 32-bit value 0xC0A80101. Octal is rarely used on purpose today, but it matters because of one trap described below.
How to use the converter
- Paste one or more addresses, one per line. Leave Input format on Auto-detect, or choose it if the input is ambiguous.
- Choose the format you want in Convert to. The main box shows that format for every line.
- Below, every other representation of the first address is listed with a Copy button, along with how the input was read and what type of address it is.
- Links such as
?mode=ip-to-binary,?mode=decimal-to-ipor?mode=ipv6-to-binaryopen the tool with that conversion selected.
The leading-zero trap
Many systems, including the classic C function inet_aton() and web browsers following the WHATWG URL standard, read a part with a leading zero as octal. That means 010.001.001.001 is 8.1.1.1, not 10.1.1.1. Browsers also accept a single decimal or hex number as a host, so http://3232235777/ and http://0xC0A80101/ both go to 192.168.1.1. Auto-detect follows the same octal rule and tells you when it applied it; choose IPv4 dotted decimal to force decimal. If you write security filters or allow-lists, normalize addresses to one canonical form before comparing them, because the same address can be spelled many ways.
IPv6 addresses
An IPv6 address is a 128-bit number, written as eight groups of four hex digits separated by colons. Leading zeros in a group can be dropped and one run of all-zero groups can be replaced by ::, so 2001:0db8:0000:0000:0000:ff00:0042:8329 becomes 2001:db8::ff00:42:8329. RFC 5952 fixes the preferred compressed form: lowercase letters, the longest run of zeros compressed (the first one if two runs are equally long), and a single zero group never compressed. The converter always outputs that canonical form, plus the fully expanded address, the binary form with 16 bits per group, 32 hex digits, and the exact 128-bit integer. Zone IDs such as %eth0, square brackets and prefix lengths are accepted and set aside with a note; for subnet math, use the CIDR calculator.
IPv4-mapped IPv6 addresses
A dual-stack server that listens on IPv6 sees IPv4 clients as IPv4-mapped addresses in the range ::ffff:0:0/96. The IPv4 address sits in the last 32 bits, and it is usually written in mixed notation, ::ffff:192.0.2.1, which equals ::ffff:c000:201 in pure hex. Paste either form and the converter shows the embedded IPv4 address; paste an IPv4 address and it shows both mapped forms.
Special address ranges
| Range | Meaning |
|---|---|
| 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 | Private networks (RFC 1918), not routed on the internet |
| 127.0.0.0/8 and ::1 | Loopback: the machine itself |
| 169.254.0.0/16 and fe80::/10 | Link-local, auto-assigned on the local link |
| 100.64.0.0/10 | Carrier-grade NAT shared address space |
| 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24, 2001:db8::/32 | Reserved for documentation and examples |
| 224.0.0.0/4 and ff00::/8 | Multicast |
| fc00::/7 | IPv6 unique local addresses, the IPv6 counterpart of private ranges |
| 0.0.0.0 and :: | Unspecified address, meaning “any” or “none yet” |
Frequently asked questions
How do I convert an IP address to a decimal number?
Multiply the octets by 16,777,216, 65,536, 256 and 1 and add them. For 192.168.1.1 that gives 3,232,235,777. Paste the address above and the converter does it instantly.
How do I convert a decimal number back to an IP address?
Choose Decimal integer as the input, or leave Auto-detect on, and enter the number. For example 3232235777 becomes 192.168.1.1. Numbers above 4,294,967,295 are read as IPv6 addresses.
How do I write an IP address in binary?
Write each octet as exactly eight bits and keep the dots: 192.168.1.1 is 11000000.10101000.00000001.00000001. Choose Binary (dotted) or Binary (32-bit) as the output.
Why does 010.1.1.1 become 8.1.1.1?
Many programs and browsers read a part with a leading zero as octal, and octal 10 is decimal 8. Choose IPv4 dotted decimal as the input format to read leading zeros as decimal instead.
Can I convert IPv6 addresses?
Yes. Paste any IPv6 address and the converter shows the compressed and fully expanded forms, binary, hex and the 128-bit integer. IPv4-mapped addresses such as ::ffff:192.0.2.1 also show the embedded IPv4 address.
Can I convert many IP addresses at once?
Yes. Put one address per line; the main result shows the chosen format for every line, and errors are reported with their line number.