EasyUnitConverter.com

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.

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.

CIDRSubnet MaskUsable Hosts
/8255.0.0.016,777,214
/16255.255.0.065,534
/24255.255.255.0254
/25255.255.255.128126
/26255.255.255.19262
/27255.255.255.22430
/28255.255.255.24014
/29255.255.255.2486
/30255.255.255.2522
/32255.255.255.2551

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).

Related Converters: