IP Address Converter
Convert IPv4 addresses between dotted decimal, binary, hexadecimal, and integer formats. Includes subnet information. See also Binary to Decimal and Hex to Decimal.
IPv4 Address Structure — 32 Bits in 4 Octets
192
Octet 1
168
Octet 2
1
Octet 3
1
Octet 4
Subnet Mask /24 — Network vs Host
Network (24 bits)
192.168.1
Host (8 bits)
.1
How the IP Address Converter Works
An IPv4 address is a 32-bit number. The familiar dotted-decimal notation (e.g., 192.168.1.1) splits this into four 8-bit octets separated by dots. This converter transforms the same 32-bit value between four representations: dotted decimal, binary, hexadecimal, and a single integer. It also calculates subnet information based on the CIDR prefix length you specify.
Conversion Formulas
Dotted Decimal → Integer
Integer = (octet1 × 256³) + (octet2 × 256²) + (octet3 × 256) + octet4
Example
IP: 192.168.1.1
= (192 × 16777216) + (168 × 65536) + (1 × 256) + 1
= 3221225472 + 11010048 + 256 + 1
= 3232235777
Binary: 11000000.10101000.00000001.00000001
Hex: 0xC0A80101
Subnet Mask Calculation
Mask = ~0 << (32 - CIDR)
Network = IP AND Mask
Broadcast = Network OR (NOT Mask)
Usable Hosts = 2^(32 - CIDR) - 2
IPv4 Structure
An IPv4 address consists of 32 bits divided into four octets (bytes). Each octet ranges from 0 to 255 in decimal. The address space is divided into network and host portions by the subnet mask. A /24 subnet (255.255.255.0) means the first 24 bits identify the network and the last 8 bits identify hosts within that network, allowing 254 usable host addresses.
| CIDR | Subnet Mask | Usable Hosts |
|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 |
| /16 | 255.255.0.0 | 65,534 |
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /27 | 255.255.255.224 | 30 |
| /28 | 255.255.255.240 | 14 |
| /29 | 255.255.255.248 | 6 |
| /30 | 255.255.255.252 | 2 |
| /32 | 255.255.255.255 | 1 |
Technical Details
IPv4 addresses use 32 bits, providing 4,294,967,296 (2³²) possible addresses. Private address ranges reserved by RFC 1918 are: 10.0.0.0/8 (Class A), 172.16.0.0/12 (Class B), and 192.168.0.0/16 (Class C). The loopback address is 127.0.0.1. Broadcast address 255.255.255.255 reaches all hosts on the local network. IPv6 uses 128-bit addresses to solve IPv4 address exhaustion, but this converter focuses on IPv4.
Frequently Asked Questions
Why convert an IP address to an integer?
Integer representation is useful for storing IP addresses efficiently in databases, performing range comparisons, and doing bitwise operations for subnet calculations.
What is CIDR notation?
CIDR (Classless Inter-Domain Routing) notation appends a slash and a number to an IP address (e.g., 192.168.1.0/24). The number indicates how many leading bits of the address are the network portion. A /24 means the first 24 bits are the network, leaving 8 bits for host addresses.
What is the difference between network and broadcast addresses?
The network address has all host bits set to 0 and identifies the subnet itself. The broadcast address has all host bits set to 1 and is used to send packets to all hosts on the subnet. Neither can be assigned to a host device.
Does this support IPv6?
This converter handles IPv4 addresses only. IPv6 uses 128-bit addresses written in hexadecimal groups separated by colons (e.g., 2001:0db8::1).