NetCalcLab

IP Converter

Convert an IP address between dotted-decimal, binary, hexadecimal and decimal integer notation, in either direction. IPv4 and IPv6 are both supported, and the input format is detected automatically.

The format is detected automatically. IPv4 accepts dotted-decimal, binary, hexadecimal and decimal integer input.

Examples:

The four ways to write an IPv4 address

An IPv4 address is 32 bits. Those same 32 bits can be written in several notations, and different tools and systems expect different ones. All of them describe the identical address.

192.168.1.1 in every common notation
Dotted decimal   192.168.1.1
Dotted binary    11000000.10101000.00000001.00000001
Binary           11000000101010000000000100000001
Hexadecimal      C0A80101
Hex with prefix  0xC0A80101
Decimal integer  3232235777
Octal            30052000401
Reverse DNS      1.1.168.192.in-addr.arpa

Read the pattern once and the conversions become mechanical. Each decimal octet maps to exactly 8 bits and exactly 2 hex digits, so all four notations are the same 32 bits regrouped.

Converting decimal to binary by hand

Use the place values 128, 64, 32, 16, 8, 4, 2, 1. Work left to right: if the remaining number is at least the place value, write a 1 and subtract; otherwise write a 0.

Example: converting 168 to binary

  1. 168 ≥ 128 → 1, remainder 40
  2. 40 < 64 → 0
  3. 40 ≥ 32 → 1, remainder 8
  4. 8 < 16 → 0
  5. 8 ≥ 8 → 1, remainder 0
  6. 0 < 4, 0 < 2, 0 < 1 → 000

Result: 10101000

Check: 128 + 32 + 8 = 168. The three leading digits 101 also reveal the address is in the class B range, since a first octet of 128–191 starts with 10.

Why decimal integers matter

Storing addresses as 32-bit integers is far more efficient than storing them as strings — comparisons and range queries become single instructions rather than string operations, and a range check reduces to WHERE ip BETWEEN start AND end. This is why geolocation databases, firewall rule engines and routing hardware all work with the integer form internally.

The conversion is a straightforward weighted sum, and this page performs it with unsigned 32-bit arithmetic so addresses above 127.255.255.255 do not appear as negative numbers — a classic bug in code that uses signed Java or C# integers.

Common mistakes

  • Treating an octet with a leading zero as decimal. In some languages 010 is octal and equals 8, not 10. This is how 192.168.010.001 becomes a security problem, because it can bypass filters that match on the dotted string. The parser here rejects leading zeros instead.
  • Using a signed 32-bit type. Addresses from 128.0.0.0 upward overflow into negative values, producing wrong results for half the internet.
  • Confusing the reverse DNS zone with the reverse of the string. The name is reversed at the octet level and suffixed, not simply reversed character by character.
  • Assuming hex is always 8 digits. If a tool shows a 4-digit value, that is a 16-bit number and not a full IPv4 address.

Frequently used conversions

Common IPv4 addresses in every notation
DescriptionDottedBinary (first octet)HexDecimal
Unspecified / default route0.0.0.000000000000000000
Loopback127.0.0.1011111117F0000012130706433
First RFC 1918 range10.0.0.0000010100A000000167772160
RFC 1918 172.16 block172.16.0.010101100AC1000002886729728
Common home gateway192.168.1.111000000C0A801013232235777
192.168.0.1 variant192.168.0.111000000C0A800013232235521
Google DNS8.8.8.80000100008080808134744072
Google DNS secondary8.8.4.40000100008080404134743044
Cloudflare DNS1.1.1.1000000010101010116843009
Quad9 DNS9.9.9.90000100109090909151587081
Link-local (APIPA)169.254.0.010101001A9FE00002851995648
Broadcast255.255.255.25511111111FFFFFFFF4294967295

Individual conversion steps have their own pages: IP to binary, binary to IP, IP to hex, hex to IP, IP to decimal and decimal to IP.

Frequently asked questions

How do I convert an IP address to binary?

Convert each of the four octets to its own 8-bit binary value and join them with dots. For 192.168.1.1: 192 is 11000000, 168 is 10101000, 1 is 00000001 and 1 is 00000001, giving 11000000.10101000.00000001.00000001. Each octet is independent, so you can convert them in any order.

How do I convert an IP address to hexadecimal?

Convert each octet to two hex digits and concatenate them without dots. For 192.168.1.1 the octets become C0, A8, 01 and 01, giving C0A80101. Many tools display this with a 0x prefix or with dots between octets, but the compact eight-digit form is the most common.

How do I convert an IP address to a decimal integer?

Treat the 32 bits as a single unsigned binary number. For 192.168.1.1 the calculation is 192 × 16,777,216 + 168 × 65,536 + 1 × 256 + 1 = 3,232,235,777. Decimal integers are used by WHOIS databases, geolocation APIs and firewall rules that store addresses as numbers.

Why is the maximum decimal IPv4 value 4,294,967,295?

An IPv4 address is 32 bits, and the largest unsigned 32-bit value is 2^32 − 1 = 4,294,967,295, which corresponds to 255.255.255.255. Anything larger does not fit in 32 bits. This is also why 32-bit signed integers cannot hold IPv4 addresses safely — the top half overflows into negative numbers.

What is the reverse DNS name for an IP address?

Reverse DNS reverses the octets and appends in-addr.arpa, so 8.8.4.4 becomes 4.4.8.8.in-addr.arpa. IPv6 does the same at nibble granularity with the ip6.arpa suffix. These names are what PTR records are registered under, and they are what mail servers look up to verify a sending host.

How do I convert hexadecimal back to an IP address?

Split the eight hex digits into four pairs, then convert each pair to decimal. For C0A80101: C0 is 192, A8 is 168, 01 is 1 and 01 is 1, giving 192.168.1.1. If your value has fewer than eight digits, pad it with leading zeros first — a 4-digit value is only 16 bits, not a full address.

Can I convert an IPv6 address to decimal?

Yes, and this page does. The result is a 128-bit integer, which is a 39-digit decimal number for most addresses. Note that many tools cannot handle values this large — a 64-bit integer is not enough, so the value must be held in a BigInt or an arbitrary-precision type.