CalcTune
🎮
Fun · Tools

Subnet Calculator

Enter an IPv4 address and a CIDR prefix length or subnet mask to calculate the network address, broadcast address, usable host range, total and usable host counts, wildcard mask, and IP class. Useful for network planning, troubleshooting, and CCNA study.

/
Example values — enter yours above
Subnet Details
Network Address192.168.1.0
Broadcast Address192.168.1.255
First Usable Host192.168.1.1
Last Usable Host192.168.1.254
Subnet Mask255.255.255.0
Wildcard Mask0.0.0.255
256
Total Hosts
254
Usable Hosts
C
IP Class

IPv4 Subnetting: How Network Addresses, Masks, and CIDR Work

Subnetting is one of the foundational concepts in computer networking. It is the process of dividing a larger IP network into smaller, more manageable sub-networks (subnets), each with its own range of IP addresses. Whether you are configuring a home router, planning a corporate network, or studying for a networking certification like CCNA, understanding how subnets work is essential. This calculator takes an IPv4 address and a CIDR prefix length (or subnet mask) and computes all the key properties of the resulting subnet.

IP Addresses and Binary Representation

An IPv4 address is a 32-bit number, typically written as four decimal octets separated by dots — for example, 192.168.1.100. In binary, this address is 11000000.10101000.00000001.01100100. Each octet represents 8 bits and can range from 0 to 255. The 32-bit address space provides a theoretical maximum of approximately 4.3 billion unique addresses, though in practice many addresses are reserved for special purposes.

A subnet mask is another 32-bit number that determines which portion of an IP address identifies the network and which portion identifies the individual host. The mask consists of a contiguous block of 1-bits (the network portion) followed by a contiguous block of 0-bits (the host portion). For example, the subnet mask 255.255.255.0 in binary is 11111111.11111111.11111111.00000000, indicating that the first 24 bits are the network portion and the remaining 8 bits are the host portion.

CIDR Notation

CIDR (Classless Inter-Domain Routing) notation is a compact way to express a subnet mask. Instead of writing out the full mask (such as 255.255.255.0), CIDR notation appends a slash and the number of network bits to the IP address — for example, 192.168.1.0/24. The number after the slash indicates how many of the 32 bits belong to the network portion.

CIDR was introduced in 1993 to replace the older classful addressing system, which rigidly divided addresses into Class A (/8), Class B (/16), and Class C (/24) networks. Classful addressing wasted enormous numbers of addresses because organizations were forced to choose between blocks that were either too large or too small. CIDR allows subnet boundaries to fall on any bit position, enabling much more efficient allocation of address space.

Common CIDR prefix lengths include /24 (256 addresses, 254 usable), /25 (128 addresses, 126 usable), /30 (4 addresses, 2 usable — commonly used for point-to-point links), and /32 (a single host address). The prefix /0 represents the entire IPv4 address space, while /32 represents exactly one address.

Network Address and Broadcast Address

Every subnet has two special addresses that cannot be assigned to hosts. The network address is the first address in the subnet, obtained by performing a bitwise AND operation between the IP address and the subnet mask. All host bits in the network address are set to zero. For the subnet 192.168.1.0/24, the network address is 192.168.1.0.

The broadcast address is the last address in the subnet, obtained by setting all host bits to one. For the same subnet, the broadcast address is 192.168.1.255. Packets sent to the broadcast address are delivered to all hosts on the subnet. Between the network address and the broadcast address lie the usable host addresses — in this case, 192.168.1.1 through 192.168.1.254, giving 254 usable addresses.

Wildcard Mask

A wildcard mask is the bitwise inverse of the subnet mask. Where the subnet mask has a 1-bit, the wildcard mask has a 0-bit, and vice versa. For the subnet mask 255.255.255.0, the wildcard mask is 0.0.0.255. Wildcard masks are commonly used in access control lists (ACLs) on Cisco routers and in OSPF routing configuration to specify which bits of an address should be matched.

The wildcard mask effectively indicates the size of the host portion of the address. A wildcard mask of 0.0.0.255 means that the last 8 bits can vary — corresponding to a /24 subnet. A wildcard mask of 0.0.0.3 means only the last 2 bits can vary — corresponding to a /30 subnet with 4 total addresses.

IP Address Classes

Before CIDR, IPv4 addresses were divided into five classes based on the leading bits of the first octet. Class A addresses (first octet 0–127) use an 8-bit network portion, providing 128 networks of approximately 16.7 million hosts each. Class B addresses (128–191) use a 16-bit network portion, providing 16,384 networks of 65,534 hosts each. Class C addresses (192–223) use a 24-bit network portion, providing over 2 million networks of 254 hosts each.

Class D addresses (224–239) are reserved for multicast, and Class E addresses (240–255) are reserved for experimental use. While classful addressing is largely obsolete in modern networking, the IP class is still referenced in documentation and certification exams. This calculator identifies the class based on the first octet of the entered IP address.

Private IP address ranges — 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 — were defined in RFC 1918 and are used extensively in home and corporate networks behind NAT (Network Address Translation) devices. These addresses are not routable on the public internet, which means the same private addresses can be reused in millions of separate networks without conflict.

Practical Subnetting Examples

A small office with 50 devices might use the subnet 192.168.1.0/26, which provides 62 usable host addresses (64 total minus the network and broadcast addresses). This is more efficient than using a full /24, which would leave over 200 addresses unused.

A large campus network might allocate a /20 to each building, providing 4,094 usable addresses per building. Within each building, the /20 can be further divided into /24 subnets for individual floors or departments. This hierarchical approach simplifies routing tables and reduces broadcast domain size.

Point-to-point links between routers typically use /30 subnets (2 usable addresses) or /31 subnets (which use both addresses as host addresses, as defined in RFC 3021). Using /30 or /31 for these links conserves address space compared to assigning a full /24 to a two-device link.

Frequently Asked Questions

What is a subnet mask?

A subnet mask is a 32-bit number that separates the network portion of an IP address from the host portion. It consists of contiguous 1-bits (network) followed by contiguous 0-bits (hosts). For example, 255.255.255.0 means the first 24 bits identify the network and the last 8 bits identify individual hosts.

What does CIDR notation mean?

CIDR (Classless Inter-Domain Routing) notation expresses a subnet mask as a slash followed by the number of network bits. For example, /24 is equivalent to the subnet mask 255.255.255.0. It allows subnets to be defined at any bit boundary, not just at the traditional 8-bit class boundaries.

Why are two addresses reserved in each subnet?

The first address in a subnet is the network address (all host bits set to zero), used to identify the subnet itself. The last address is the broadcast address (all host bits set to one), used to send packets to all hosts on the subnet. Neither can be assigned to a device, so a /24 subnet with 256 total addresses has 254 usable host addresses.

What is a wildcard mask?

A wildcard mask is the bitwise inverse of the subnet mask. It is used in router access control lists and routing protocols like OSPF to specify which bits of an IP address should be matched. For subnet mask 255.255.255.0, the wildcard mask is 0.0.0.255.

What is the difference between /24 and /25 subnets?

A /24 subnet has 256 total addresses (254 usable) and a subnet mask of 255.255.255.0. A /25 subnet has 128 total addresses (126 usable) and a subnet mask of 255.255.255.128. Increasing the CIDR prefix by one halves the number of available addresses.