Skip to the tool
DevToolBench

IP Address Converter

Every way to write one IPv4 or IPv6 address, side by side.

IPv4
Try:
Dotted quad
192.168.1.1
Decimal
3232235777
Hexadecimal
0xC0A80101
Hex octets
C0.A8.01.01
Binary
11000000.10101000.00000001.00000001
Octal
0300.0250.01.01
Reverse DNS
1.1.168.192.in-addr.arpa
IPv6 mapped
::ffff:192.168.1.1
URL form
http://3232235777/

Everything runs in your browser. Nothing you type is sent to a server.

Found a bug in this tool? Report it.

Share this tool

What this tool does

This IP address converter shows one address in every notation that reaches it. Paste an IPv4 address and you get the dotted quad, the single decimal integer, hexadecimal both as one word and octet by octet, the binary, the octal, the reverse DNS name and the IPv6-mapped form. Paste an IPv6 address and you get the compressed and fully expanded spellings, its nibble-reversed ip6.arpa name and the IPv4 address it carries, when it carries one.

It also accepts the odd inputs, on purpose: 0x7F000001, 0177.0.0.1, 127.1 and 2130706433 are all read, converted, and annotated with a note explaining how they were read.

An address is a number, not four numbers

An IPv4 address is a single unsigned 32-bit integer. The dots are punctuation for humans: they split the integer into four bytes so it can be read aloud. 192.168.1.1 is 3232235777, and both spellings mean the same 32 bits.

That is why the arithmetic works out the way it does. The first octet is the top eight bits, so a number above 2147483647 has a first octet above 127. A /24 is the block where the top 24 bits are fixed, which is why it holds 256 addresses — the eight loose bits at the bottom.

The four spellings that break URL filters

The parser here follows inet_aton, the C library function that Berkeley Unix shipped in 1983 and that browsers, curl and most HTTP client libraries inherited. It accepts far more than the dotted quad:

  • A single integer. http://2130706433/ is http://127.0.0.1/.
  • Fewer than four parts. The last part fills the remaining octets, so 127.1 is 127.0.0.1 — the form that made ping 10.1 work on every machine you have ever used.
  • Octal, by leading zero. 0177.0.0.1 is 127.0.0.1. 010 is 8, not 10.
  • Hexadecimal, by 0x. 0x7F000001 is 127.0.0.1 as well.

This is the reason server-side request forgery keeps being found in code that already checks the destination. A blocklist written as a regular expression against 127\. or 169\.254\. matches none of the above, while the HTTP client resolves all of them to the address the check meant to refuse. The lesson is not to write a better regular expression: it is to parse the address into its 32 bits first, decide against the number, and only then let the request go — which is what the Decimal row here is for.

Mixed forms compose too. 0x7f.1 is valid, and so is 192.168.0x101. Every one of those produces a note under the results saying which base was used and what the part came to.

IPv6, written the way RFC 5952 asks

IPv6 gives you 128 bits in eight groups of four hex digits, and it allows several spellings of the same address. RFC 5952 picks one so that two systems logging the same address produce the same string: lowercase, no leading zeros in a group, :: over the longest run of zero groups only, the first such run when two tie, and never for a single zero group.

The tool shows both the canonical short form and the full 39-character expansion, which is the one to use when you are sorting addresses as text or building a reverse zone. If the address ends in ::ffff: plus 32 bits, it is an IPv4 address inside an IPv6 socket, and the embedded address is reported separately.

Working out how much of an address a prefix covers is the CIDR calculator next door. For the same numbers in bases that have nothing to do with addressing, use the number base converter.

Frequently asked questions

Why does http://2130706433/ open localhost?

Because 2130706433 is 127.0.0.1 as a single 32-bit number, and the resolver in your browser accepts that form. An IPv4 address is one integer; the dots are a convenience that splits it into four bytes. Drop the dots and the whole integer still names the same host, which is why the decimal, hexadecimal and octal forms in the results all reach the machine you are sitting at.

Are 0177.0.0.1 and 127.0.0.1 the same address?

Yes. A part with a leading zero is read as octal, a rule inherited from inet_aton in 1983, and 0177 in octal is 127. The same goes for 0x7f, which is hexadecimal for 127. Software written this century mostly keeps the behaviour for compatibility, so the odd spellings still resolve while looking nothing like the address they name.

How do I write an IPv6 address correctly?

RFC 5952 gives four rules: lowercase hex, no leading zeros inside a group, the double colon over the longest run of zero groups, and never a double colon standing in for a single zero group. So 2001:0DB8:0000:0000:0000:0000:0000:0001 is written 2001:db8::1, and 2001:db8:0:1:1:1:1:1 keeps its lone zero written out. The tool applies all four.

What is the in-addr.arpa name for?

Reverse DNS. To find the name behind an address, a resolver asks for the PTR record of the octets reversed under in-addr.arpa, so 127.0.0.1 becomes 1.0.0.127.in-addr.arpa. IPv6 does the same under ip6.arpa, but nibble by nibble, which is why a reverse name for one IPv6 address is 32 labels long.

Does the tool send my address anywhere?

No. The arithmetic is a handful of shifts and it happens in this tab, so nothing you paste leaves the browser. That matters here because internal addresses are the sort of thing that ends up in a bug report or a support ticket by accident.

Related tools

Updated