正在加载,请稍候…

IPv4 Address Converter: Decimal, Binary, Hex, and Integer

Convert IPv4 addresses between dotted decimal, binary, hexadecimal, and 32-bit integer representations.

Understanding IPv4 Address Representations

An IPv4 address is a 32-bit number. While humans read it in dotted-decimal notation (192.168.1.1), computers work with it as a single 32-bit integer. Different contexts require different representations, which is why IP address conversion tools are essential for network engineers, security professionals, and developers.

IPv4 Address Formats

Dotted-Decimal Notation

The most familiar format: four 8-bit octets separated by dots. Each octet ranges from 0 to 255, representing 8 binary bits.

Binary Representation

Shows the underlying 32-bit structure, revealing the network/host boundary when combined with a subnet mask. Converting 192.168.1.1 to binary gives: 11000000.10101000.00000001.00000001

Hexadecimal Notation

Base-16 representation, common in programming and packet analysis. 192.168.1.1 becomes 0xC0A80101. Each byte maps to two hex digits.

32-Bit Integer (Long Integer)

The raw numeric value of the IP address. 192.168.1.1 equals 3,232,235,777. Calculated by treating the dotted decimal as a 4-byte big-endian number.

IPv4-Mapped IPv6

IPv4 addresses represented in IPv6 format: 192.168.1.1 becomes ::ffff:192.168.1.1 or ::ffff:c0a8:0101

Why Multiple Formats Matter

Network Programming

Socket APIs often work with integer representations. Python's socket.inet_aton() and C's inet_pton() convert between string and binary forms. Storing IPs as integers in code enables efficient arithmetic comparisons and range checks.

Database Storage

Storing IPs as integers is more efficient and enables range queries. Integer comparison is much faster than string comparison, and range queries for subnet membership become simple numeric comparisons.

Packet Analysis

Wireshark and hex dump tools show packet data in hexadecimal. Network engineers need to convert between hex and dotted-decimal when analyzing packet captures and network traces.

Regular Expressions and Pattern Matching

Understanding the binary structure helps write precise IP-matching patterns for security rules and log analysis scripts.

IP Address Classes (Historical)

Before CIDR, IPv4 used classful addressing:

Class Range Default Mask Usage
A 0.0.0.0 - 127.255.255.255 /8 Large organizations
B 128.0.0.0 - 191.255.255.255 /16 Medium organizations
C 192.0.0.0 - 223.255.255.255 /24 Small networks
D 224.0.0.0 - 239.255.255.255 Multicast
E 240.0.0.0 - 255.255.255.255 Reserved

Classes A, B, and C are for unicast. Classful addressing is largely obsolete (replaced by CIDR), but understanding it helps when reading older documentation and legacy network configurations.

Special IPv4 Addresses

Key special address ranges:

  • 0.0.0.0/8 — Unspecified/this network
  • 127.0.0.0/8 — Loopback (localhost)
  • 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 — Private (RFC 1918)
  • 169.254.0.0/16 — Link-local (APIPA)
  • 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 — Documentation/TEST-NET
  • 224.0.0.0/4 — Multicast
  • 255.255.255.255/32 — Limited broadcast

Converting Between Formats

To convert dotted-decimal to integer:

  1. Split by dots into four numbers
  2. Multiply: first * 16777216 + second * 65536 + third * 256 + fourth
  3. Result is the 32-bit integer

To convert integer to dotted-decimal:

  1. Divide by 16777216 for first octet (take integer part, keep remainder)
  2. Divide remainder by 65536 for second octet
  3. Divide remainder by 256 for third octet
  4. Remainder is the fourth octet

Using the IPv4 Address Converter

Our converter tool handles:

  1. Input any format — dotted-decimal, integer, hex, or binary
  2. See all representations simultaneously in a clear layout
  3. Subnet information — paste a CIDR address to see network details
  4. Copy any format with one click
  5. Batch conversion support for processing multiple addresses

Perfect for network documentation, programming projects that need IP arithmetic, and troubleshooting network configurations where different tools use different IP representations.