Home › Other Calculators › IP Subnet Calculator

IP Subnet Calculator

Calculate subnet mask, network address, broadcast address, usable host range, wildcard mask, and more — for both IPv4 and IPv6 networks. Instant results with detailed binary breakdown.

Enter any valid IPv4 address (dotted decimal notation)
📋 IPv4 Subnet Details
🔢 Binary / Network Bit Map (32 bits)
Network bits Host bits
📊 Subnet Summary Table
#Network AddressFirst HostLast HostBroadcast
Enter a full or compressed IPv6 address
📋 IPv6 Subnet Details
Advertisement
240 × 600
Ad Space
Paste your ad tag here

What Is IP Subnetting? A Complete Beginner-to-Advanced Guide

IP subnetting is the process of dividing a large IP network into smaller, more manageable sub-networks called subnets. Each subnet is a logical partition of a larger network that allows network administrators to improve performance, security, and organisation of IP address space.

Every device connected to the internet or a local network — computers, smartphones, printers, routers, servers — requires a unique IP address. Without subnetting, all these devices would be on one flat, unorganised network, creating enormous security risks, performance bottlenecks, and administrative nightmares. Subnetting solves these problems by creating structured, hierarchical networks.

Simple Analogy: Think of an IP address as a street address. The network portion is like the city and street name, and the host portion is the house number. Subnetting is like dividing a large city into smaller neighbourhoods — each with its own street naming convention — for better organisation and security.
32
IPv4 bits total
128
IPv6 bits total
/24
Most common CIDR
254
/24 usable hosts

Why Is Subnetting Important?

Subnetting is not just a theoretical networking concept — it has major practical implications for how networks are built and managed:

  • Security isolation: Separating departments (finance, HR, engineering) onto different subnets prevents lateral movement in the event of a security breach.
  • Performance improvement: Broadcast traffic only reaches devices on the same subnet, dramatically reducing network congestion in large networks.
  • Efficient IP address utilisation: Instead of wasting a large Class A block on a small office, you allocate exactly the right-sized subnet.
  • Simplified troubleshooting: Problems can be isolated to a specific subnet rather than affecting the entire network.
  • VLANs and routing: Subnets align with VLANs in enterprise networking, enabling fine-grained traffic control between segments.
  • Compliance and auditing: Regulatory frameworks like PCI-DSS require cardholder data environments to be isolated on separate network segments.

Understanding IP Address Structure

Before diving into subnetting, you need a solid understanding of how IP addresses are structured. IPv4 and IPv6 are the two versions in active use today, and they work very differently.

IPv4 Address Structure

An IPv4 address is a 32-bit number, typically written in dotted decimal notation — four groups of decimal numbers (called octets) separated by dots. Each octet represents 8 bits and can range from 0 to 255.

192.168.1.100 → 11000000 . 10101000 . 00000001 . 01100100 → Network portion + Host portion (determined by subnet mask)

The 32-bit address is split into two parts by the subnet mask:

  • Network portion (prefix): Identifies which network the device belongs to. All devices on the same subnet share the same network portion.
  • Host portion: Identifies the specific device within that network. This must be unique for each device on the subnet.
✔ Example — Breaking down 192.168.10.50/24

IP Address: 192.168.10.50

Subnet Mask (/24): 255.255.255.0

Network Address: 192.168.10.0 (first 24 bits)

Host Part: .50 (last 8 bits — the device identifier)

Broadcast: 192.168.10.255 (all host bits set to 1)

Usable Range: 192.168.10.1 – 192.168.10.254 (254 hosts)

The Subnet Mask Explained

The subnet mask is a 32-bit number that uses a contiguous sequence of 1s to indicate the network portion, followed by 0s for the host portion. It is written either in dotted decimal (255.255.255.0) or CIDR notation (/24).

CIDRSubnet MaskBinary PatternUsable HostsClass
/8255.0.0.011111111.00000000.00000000.0000000016,777,214A
/16255.255.0.011111111.11111111.00000000.0000000065,534B
/24255.255.255.011111111.11111111.11111111.00000000254C
/25255.255.255.12811111111.11111111.11111111.10000000126C sub
/26255.255.255.19211111111.11111111.11111111.1100000062C sub
/27255.255.255.22411111111.11111111.11111111.1110000030C sub
/28255.255.255.24011111111.11111111.11111111.1111000014C sub
/29255.255.255.24811111111.11111111.11111111.111110006C sub
/30255.255.255.25211111111.11111111.11111111.111111002Point-to-point

Key Addresses in Every Subnet

Every subnet has three special addresses that are reserved and cannot be assigned to hosts:

  • Network Address (first): All host bits are 0. Identifies the subnet itself. Example: 192.168.1.0 in a /24.
  • Broadcast Address (last): All host bits are 1. Packets sent here reach every device on the subnet. Example: 192.168.1.255 in a /24.
  • Default Gateway: Not technically reserved by the protocol, but conventionally the first usable host (e.g., 192.168.1.1) is assigned to the router interface.
Usable Hosts = 2^(32 - CIDR prefix) - 2 Example (/24): 2^(32-24) - 2 = 2^8 - 2 = 256 - 2 = 254 hosts

CIDR vs. Classful Networking

To fully understand modern subnetting, you need to know the historical context — specifically the transition from classful networking to CIDR (Classless Inter-Domain Routing).

Classful Networking (Pre-1993)

Originally, the Internet Engineering Task Force (IETF) defined IP address allocation based on rigid, predefined classes. The class of an address determined the network size, with no flexibility:

ClassFirst Octet RangeDefault MaskNetworksHosts per NetworkUse Case
Class A1 – 126255.0.0.0 (/8)12616,777,214Large ISPs, governments
Class B128 – 191255.255.0.0 (/16)16,38265,534Universities, large companies
Class C192 – 223255.255.255.0 (/24)2,097,150254Small businesses, offices
Class D224 – 239N/A——Multicast groups
Class E240 – 255N/A——Experimental / Reserved
The Problem with Classful Networking: A company needing 300 hosts had to receive a Class B block with 65,534 addresses — wasting 65,234 addresses. This inefficiency accelerated IPv4 address exhaustion. The Internet Assigned Numbers Authority (IANA) declared IPv4 address pool exhaustion in February 2011.

CIDR — Classless Inter-Domain Routing (Post-1993)

CIDR, introduced in RFC 1519 in 1993, replaced the rigid class system with flexible prefix-based allocation. Using CIDR, any number of bits can be designated as the network prefix, expressed with slash notation (e.g., /22, /27).

CIDR Advantage: A company needing 300 hosts gets a /23 block (510 usable hosts) instead of a /16 (65,534 hosts) — wasting only 210 addresses instead of 65,234. CIDR also enables route aggregation (supernetting), which reduces the size of global routing tables.
✔ CIDR Subnetting Example — Dividing a /24 into 4 subnets

Start with 192.168.1.0/24. Borrow 2 bits from the host portion to create 4 subnets (/26):

Subnet 1: 192.168.1.0/26 → hosts .1–.62, broadcast .63

Subnet 2: 192.168.1.64/26 → hosts .65–.126, broadcast .127

Subnet 3: 192.168.1.128/26 → hosts .129–.190, broadcast .191

Subnet 4: 192.168.1.192/26 → hosts .193–.254, broadcast .255

Each subnet has 62 usable host addresses.

Private vs. Public IP Addresses

Not all IP addresses route across the public Internet. RFC 1918 defines three ranges of private IP addresses reserved exclusively for internal/local network use. These addresses are not routable on the Internet — they are translated to public IPs through Network Address Translation (NAT) at the router boundary.

RangeCIDR BlockAddresses AvailableCommon Use
10.0.0.0 – 10.255.255.25510.0.0.0/816,777,216Large enterprises, data centres
172.16.0.0 – 172.31.255.255172.16.0.0/121,048,576Medium organisations
192.168.0.0 – 192.168.255.255192.168.0.0/1665,536Home networks, small offices

Special-Purpose IPv4 Addresses

Address RangePurpose
127.0.0.0/8Loopback (localhost) — testing local networking stack
169.254.0.0/16Link-local (APIPA) — auto-assigned when DHCP fails
0.0.0.0/8This network — used in routing tables
255.255.255.255Limited broadcast — reaches all hosts on local subnet
224.0.0.0/4Multicast — Class D addresses
100.64.0.0/10Shared address space (RFC 6598) — ISP NAT environments

IPv6 — The Next Generation of IP Addressing

IPv6 (Internet Protocol version 6) was developed to address the imminent exhaustion of IPv4 addresses. While IPv4 provides approximately 4.3 billion unique addresses, IPv6 provides an almost incomprehensible 340 undecillion (3.4 × 10³⁸) addresses — enough to assign a unique address to every atom on the surface of the Earth, multiple times over.

IPv6 Address Format

An IPv6 address is a 128-bit number written as eight groups of four hexadecimal digits, separated by colons:

2001:0db8:85a3:0000:0000:8a2e:0370:7334 → Can be compressed to: 2001:db8:85a3::8a2e:370:7334 (leading zeros omitted, consecutive zero groups replaced with ::)

IPv6 Address Types

TypePrefixDescription
Global Unicast2000::/3Publicly routable — equivalent to public IPv4
Link-Localfe80::/10Auto-configured, not routable beyond local segment
Unique Localfc00::/7Private addresses — equivalent to RFC 1918
Loopback::1/128Equivalent to IPv4 127.0.0.1
Multicastff00::/8One-to-many delivery
Unspecified::/128Equivalent to IPv4 0.0.0.0

IPv6 Prefix Hierarchy

IPv6 uses a structured prefix allocation hierarchy designed for aggregation and efficiency:

  • /32 — Allocated to Internet Service Providers (ISPs)
  • /48 — Allocated to individual sites or customers
  • /56 — Allocated to home users by some ISPs
  • /64 — Standard subnet size (recommended for all end-user subnets)
  • /128 — Single host address (loopback, anycast)
Why /64 for subnets? The /64 boundary is a deliberate design choice in IPv6. The lower 64 bits (Interface ID) are often auto-generated using SLAAC (Stateless Address Autoconfiguration) based on the device's MAC address (EUI-64). This means devices can configure themselves without DHCP, which greatly simplifies network administration.

How to Subnet: Step-by-Step Method

Subnetting can be done mathematically or using a calculator like this one. Understanding the manual process gives you deeper insight into how networks work and prepares you for networking certifications (CCNA, Network+, etc.).

Step 1 — Identify Your Requirements

Before subnetting, determine: How many subnets do you need? How many hosts per subnet? Start with the larger requirement.

Step 2 — Choose Your Starting Block

You need an IP block large enough to accommodate all your subnets and hosts. Use the formula: Total addresses needed = number of subnets × hosts per subnet (rounded up to nearest power of 2).

Step 3 — Determine the CIDR Prefix

Hosts per subnet = 2^(32 - prefix) - 2 Subnets from a block = 2^(prefix - original_prefix) For 30 hosts → need 32 addresses → /27 (gives 30 usable hosts) For 60 hosts → need 64 addresses → /26 (gives 62 usable hosts) For 120 hosts → need 128 addresses → /25 (gives 126 usable hosts)

Step 4 — Calculate Key Addresses

✔ Full worked example — 172.16.0.0/20

Network: 172.16.0.0

Mask /20: 255.255.240.0 → binary: 11111111.11111111.11110000.00000000

Wildcard: 0.0.15.255

Broadcast: 172.16.15.255 (network OR wildcard)

First host: 172.16.0.1

Last host: 172.16.15.254

Total hosts: 2^12 = 4,096 → usable: 4,094

Variable Length Subnet Masking (VLSM)

VLSM allows you to use different subnet sizes within the same network, assigning exactly the right number of addresses to each segment. This is essential for efficient addressing in complex enterprise networks.

✔ VLSM Example — Allocating 192.168.10.0/24

Department A (100 hosts needed): 192.168.10.0/25 → 126 usable hosts

Department B (50 hosts needed): 192.168.10.128/26 → 62 usable hosts

Department C (25 hosts needed): 192.168.10.192/27 → 30 usable hosts

WAN Link (2 hosts needed): 192.168.10.224/30 → 2 usable hosts

Total used: 250 of 254 available — 98% efficiency

Complete IPv4 Subnet Reference Table

This comprehensive reference table covers all 32 possible IPv4 prefix lengths, their corresponding subnet masks, usable host counts, and the number of subnets they create from a /8, /16, or /24 base block.

CIDRSubnet MaskWildcardTotal IPsUsable HostsClass
/8255.0.0.00.255.255.25516,777,21616,777,214A
/9255.128.0.00.127.255.2558,388,6088,388,606A
/10255.192.0.00.63.255.2554,194,3044,194,302A
/11255.224.0.00.31.255.2552,097,1522,097,150A
/12255.240.0.00.15.255.2551,048,5761,048,574A
/13255.248.0.00.7.255.255524,288524,286A
/14255.252.0.00.3.255.255262,144262,142A
/15255.254.0.00.1.255.255131,072131,070A
/16255.255.0.00.0.255.25565,53665,534B
/17255.255.128.00.0.127.25532,76832,766B
/18255.255.192.00.0.63.25516,38416,382B
/19255.255.224.00.0.31.2558,1928,190B
/20255.255.240.00.0.15.2554,0964,094B
/21255.255.248.00.0.7.2552,0482,046B
/22255.255.252.00.0.3.2551,0241,022B
/23255.255.254.00.0.1.255512510B
/24255.255.255.00.0.0.255256254C
/25255.255.255.1280.0.0.127128126C
/26255.255.255.1920.0.0.636462C
/27255.255.255.2240.0.0.313230C
/28255.255.255.2400.0.0.151614C
/29255.255.255.2480.0.0.786C
/30255.255.255.2520.0.0.342Point-to-Point
/31255.255.255.2540.0.0.120*P2P (RFC 3021)
/32255.255.255.2550.0.0.010*Host Route

* /31 and /32 are special cases. /31 allows 2 usable hosts for point-to-point links per RFC 3021. /32 is used for host routes in routing tables.

Frequently Asked Questions — IP Subnet Calculator

Answers to the most commonly asked questions about IP addressing, subnetting, CIDR, and network design.

A subnet mask is a 32-bit number that tells devices which part of an IP address is the network and which is the host. It uses consecutive 1-bits for the network portion and 0-bits for the host portion. A device performs a binary AND operation between the IP address and the subnet mask to find the network address. For example, with IP 192.168.1.100 and mask 255.255.255.0 (/24), the network is 192.168.1.0 and the host is .100.
CIDR (Classless Inter-Domain Routing) notation compresses an IP address and its subnet mask into one expression using a slash and prefix length. For example, 192.168.1.0/24 means a /24 network prefix (255.255.255.0 mask). CIDR replaced the rigid class system (A/B/C) in 1993 and enables far more flexible and efficient IP address allocation. It also enables route aggregation, which reduces global routing table sizes.
A /24 subnet provides 254 usable host addresses. The math: 2^(32-24) = 2^8 = 256 total addresses, minus 2 reserved (network address and broadcast address) = 254. The usable range in a typical 192.168.1.0/24 network is 192.168.1.1 through 192.168.1.254. The network address (.0) and broadcast (.255) cannot be assigned to devices.
IPv4 uses 32-bit addresses (~4.3 billion total) in dotted decimal format (e.g., 192.168.1.1). IPv6 uses 128-bit addresses (340 undecillion total) in hexadecimal with colons (e.g., 2001:db8::1). IPv6 eliminates the need for NAT, supports SLAAC auto-configuration, has built-in IPSec, and more efficient routing headers. IPv6 adoption has been growing since 2006 as IPv4 exhaustion accelerated.
The network address is the first IP in a subnet with all host bits set to 0 — it identifies the subnet and cannot be assigned to hosts. The broadcast address is the last IP with all host bits set to 1 — packets sent here reach every device on that subnet simultaneously. In 192.168.1.0/24: network = 192.168.1.0, broadcast = 192.168.1.255, usable hosts = .1 to .254.
RFC 1918 defines three private IP ranges not routable on the public Internet: 10.0.0.0/8 (10.x.x.x — large enterprises, 16M+ addresses), 172.16.0.0/12 (172.16–31.x.x — medium networks, 1M+ addresses), and 192.168.0.0/16 (192.168.x.x — home/small office, 65K addresses). Devices using these addresses reach the Internet through NAT (Network Address Translation) at their router.
A wildcard mask is the bitwise inverse of the subnet mask. Calculate it by subtracting the subnet mask from 255.255.255.255. For /24 (mask 255.255.255.0): wildcard = 0.0.0.255. Wildcard masks are used in Cisco ACLs (Access Control Lists) to specify address ranges — a 0 bit means the corresponding address bit must match, and a 1 bit means it can be anything. They are also used in OSPF network statements.
Use the formula: Number of subnets = 2^(new prefix − original prefix). Example: dividing a /24 into /27 subnets borrows 3 bits (27-24=3), creating 2^3 = 8 subnets, each with 30 usable hosts. For hosts per subnet: Hosts = 2^(32 − new prefix) − 2. So /27 gives 2^5 − 2 = 30 hosts. The -2 accounts for the reserved network and broadcast addresses.
VLSM allows different subnets within the same address space to use different prefix lengths. Instead of splitting one /24 into eight equal /27s (30 hosts each), you can create subnets exactly sized for each segment: a /25 for 100 devices, a /27 for 25 devices, a /30 for a router-to-router link. This maximises address efficiency. VLSM requires classless routing protocols (OSPF, EIGRP, BGP) that carry the prefix length in their routing updates.
A /32 prefix uses all 32 bits for the network, leaving zero bits for hosts — it identifies a single specific IP address. /32 is used for loopback interfaces on routers, host routes in routing tables pointing to a specific device, firewall rules targeting one IP, and BGP routes for individual server IPs. The subnet mask is 255.255.255.255. Both network and broadcast addresses are the same as the host address.

Related Calculators & Tools