Advertisement

IP address converter

Paste an address in dotted decimal, binary, hexadecimal, decimal or octal and the page shows the same address in every other form. IPv4 addresses also show their IPv4-mapped IPv6 form, which is useful when reading dual-stack logs.

Calculator

The format above decides how the value is read. Spaces and colons are ignored in binary and hexadecimal input.

IPv4 address
192.168.1.1
IPv6 address
::ffff:192.168.1.1
Binary
11000000 10101000 00000001 00000001
Hexadecimal
C0A80101
Decimal
3232235777
Dotted octal
300.250.1.1
Address width in bits
32

Advertisement

How this calculator works

An IP address is a binary number with either 32 bits (IPv4) or 128 bits (IPv6). The familiar dotted form groups the 32 bits into four octets and writes each as a decimal number. Hexadecimal writes the same value in base 16, binary shows each bit, and the decimal form is the single integer value used by many databases and access lists. IPv6 is written as eight groups of four hex digits, with the longest run of zero groups replaced by a double colon. Addresses that begin with 80 zero bits, then sixteen 1 bits, are IPv4-mapped IPv6 addresses, and this page shows both faces of those.

Formula

IPv4 dotted value = octet1 x 2^24 + octet2 x 2^16 + octet3 x 2^8 + octet4. For example 192.168.1.1 = 192 x 16,777,216 + 168 x 65,536 + 1 x 256 + 1 = 3,232,235,777. IPv6 uses the same positional rule with 128 bits, grouped as eight 16-bit blocks.

Worked example

The address 192.168.1.1 is 3,232,235,777 in decimal, C0A80101 in hexadecimal and 11000000 10101000 00000001 00000001 in binary. As a dotted octal address it is 300.250.1.1. Its IPv4-mapped IPv6 form is ::ffff:192.168.1.1. The IPv6 address 2001:db8::1 is 20010db8000000000000000000000001 in hex.

Advertisement

Frequently asked questions

Why does the IPv4 address show an IPv6 form?

Every IPv4 address can be embedded in an IPv6 address with the ::ffff: prefix, called an IPv4-mapped address. Dual-stack systems listen on both, so seeing the mapped form in a log or a socket listing is normal. This page shows it for convenience; it is not a different address.

How is IPv6 shortened?

The longest run of two or more zero groups is replaced by one double colon, and leading zeros in each group are dropped. Only one double colon may appear. For example 2001:0db8:0000:0000:0000:0000:0000:0001 becomes 2001:db8::1.

Is the decimal form used anywhere?

Yes. Some databases, firewall rules and command-line tools accept a single integer, and the old inet_aton call accepts it too. Decimal notation is ambiguous for IPv6, so prefer standard notation there.

Can this tell me whether an address is public or private?

Not directly. Private IPv4 ranges are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, and IPv6 has unique local addresses starting with fc00::/7. Use the subnet calculator to see the network an address belongs to.

Sources

Advertisement