Free IP Subnet Calculator - IPv4 & IPv6 CIDR Tool

Calculate subnet masks, network addresses, broadcast addresses, and usable host ranges for IPv4 and IPv6. CIDR notation support.

Advertisement

Work out a subnet's network, broadcast and usable host range

Type an IP address and a CIDR prefix and this subnet calculator returns the network address, broadcast address, subnet mask, wildcard mask, usable host range, total and usable host counts, address class and address type — recalculating as you type, with no submit button. Everything runs in your browser: the address you enter is never sent to a server, which matters when the thing you are subnetting is a customer's production network.

Beyond the basic calculation there are two more tabs. CIDR Merger collapses a messy list of ranges and prefixes into the smallest set of CIDR blocks that covers them, which is how you clean up a firewall object group. VLAN Planning lays out a VLAN table with validation and then emits ready–to–paste switch configuration for nine platforms. The calculator also has an IPv6 mode, AWS VPC and Azure VNet subnet templates, a binary view, and generated ping–sweep commands for the network you just calculated.

How to use the calculator

  • Enter the address in the IP Address field — 192.168.1.0, or any host inside the network you care about.
  • Enter the prefix in the CIDR field, 0 to 32. You do not need to know the dotted–decimal mask; the tool derives it and shows it back to you.
  • Read the Network Information panel for the network address, broadcast address, subnet mask, wildcard mask and canonical CIDR notation, and the Host Information panel for the usable range, host counts, class and type. Every row has a copy button.
  • Toggle Binary Representation when you need to see where the mask boundary actually falls — the reason a /22 behaves the way it does is much easier to explain from the binary than from the decimal.
  • Use the share–link button to hand someone the exact calculation. The address, prefix, active tab and binary toggle are all encoded in the URL.

You can paste in a host address rather than a network address and the tool will mask it down for you. Enter 192.168.1.130/26 and it reports the network as 192.168.1.128, not 192.168.1.130 — which is exactly the answer you want when you are trying to work out which subnet a given machine is sitting in.

Worked example: subnetting 192.168.1.0

A single /24 is 256 addresses: network 192.168.1.0, broadcast 192.168.1.255, and 254 usable hosts from 192.168.1.1 to 192.168.1.254, mask 255.255.255.0, wildcard 0.0.0.255. Every subnet below is carved out of that same space, and each step down the table halves the block.

CIDRSubnet maskBlockNetworkUsable rangeBroadcastUsable hosts
/24255.255.255.0256192.168.1.0192.168.1.1 – 192.168.1.254192.168.1.255254
/25255.255.255.128128192.168.1.0192.168.1.1 – 192.168.1.126192.168.1.127126
/25255.255.255.128128192.168.1.128192.168.1.129 – 192.168.1.254192.168.1.255126
/26255.255.255.19264192.168.1.0192.168.1.1 – 192.168.1.62192.168.1.6362
/26255.255.255.19264192.168.1.64192.168.1.65 – 192.168.1.126192.168.1.12762
/26255.255.255.19264192.168.1.128192.168.1.129 – 192.168.1.190192.168.1.19162
/26255.255.255.19264192.168.1.192192.168.1.193 – 192.168.1.254192.168.1.25562
/27255.255.255.22432192.168.1.0192.168.1.1 – 192.168.1.30192.168.1.3130
/28255.255.255.24016192.168.1.0192.168.1.1 – 192.168.1.14192.168.1.1514
/30255.255.255.2524192.168.1.0192.168.1.1 – 192.168.1.2192.168.1.32

The pattern to internalise is the block size column, because it tells you where the next subnet starts. At /26 the block is 64, so the valid network addresses are 0, 64, 128 and 192 — and nothing else. A subnet cannot start at 192.168.1.100 with a /26 prefix; type that in and the calculator will silently give you 192.168.1.64, because that is the network the address belongs to.

Two more examples outside the third octet. 10.0.4.0/22 gives mask 255.255.252.0, wildcard 0.0.3.255, broadcast 10.0.7.255, and 1,022 usable hosts from 10.0.4.1 to 10.0.7.254 — note that the range spans four third–octet values, which is the part people get wrong by hand. And the whole RFC 1918 middle block, 172.16.0.0/12, has mask 255.240.0.0 and runs to a broadcast of 172.31.255.255: it covers 172.16 through 172.31, not 172.16 through 172.32.

Wildcard masks, binary view and ping sweeps

The wildcard mask row is the mask inverted — each octet subtracted from 255 — and it is what Cisco ACLs and OSPF network statements expect. A /26 gives 0.0.0.63, so access-list 10 permit 192.168.1.128 0.0.0.63 matches that whole subnet. Copying it straight out of the calculator removes the most common source of ACL typos.

Below the results the tool generates a ping sweep for the network you just calculated, in three flavours: a Bash loop, a Windows for /L loop, and an nmap -sn one–liner. For a /24 the Bash form sweeps .1 to .254 in parallel; for a /25 through /30 it uses the actual first and last host octets rather than assuming a full range; for a /31 it pings both endpoints; and for anything larger than a /24 it stops trying to build a shell loop and tells you to use nmap, which is the correct advice. Use these on networks you are authorised to scan.

Merging a messy list of subnets into minimal CIDR blocks

The CIDR Merger tab takes one entry per line and accepts three input formats interchangeably: CIDR notation (192.168.1.0/25), explicit ranges (172.16.5.100-172.16.5.110), and bare single addresses. Lines beginning with # are treated as comments, so you can paste an annotated firewall export straight in. It sorts, merges anything overlapping or contiguous, and re–expresses the result as the smallest set of aligned CIDR blocks.

Load the built–in example and you get eight input lines that expand to 13 CIDR blocks. After merging, six blocks remain — a 54% reduction:

  • 192.168.1.0/25 and 192.168.1.128/25 are adjacent halves, so they collapse to 192.168.1.0/24.
  • The four /26s at 10.0.0.0, 10.0.0.64, 10.0.0.128 and 10.0.0.192 tile a full /24, so they collapse to 10.0.0.0/24.
  • 172.16.5.100-172.16.5.110 and 172.16.5.111-172.16.5.120 are contiguous, so they merge into the single range 172.16.5.100 to 172.16.5.120. That range is not power–of–two aligned, so it needs four blocks to express exactly: 172.16.5.100/30, 172.16.5.104/29, 172.16.5.112/29 and 172.16.5.120/32.

That last case is the one worth studying. Merging reduced the block count from seven to four, but it could not produce a single prefix, because CIDR blocks must start on an address that is a multiple of their own size. This is also why the merger never widens your ranges to get a tidier answer — it will hand you four awkward prefixes rather than one over–broad /27 that quietly permits addresses you did not list. If you would rather have the tidy prefix, that is a decision for you to make deliberately, not for the tool to make for you.

VLAN planning and switch configuration

The VLAN Planning tab builds a table of VLANs — ID, name, description, subnet and prefix, gateway, purpose, access or trunk, and whether routing is enabled — and validates as you go. It flags reserved VLAN IDs, including VLAN 1 (the default VLAN, a standing recommendation to avoid for production traffic) and the Cisco–reserved 1002 through 1005, and it detects subnet overlaps between the VLANs you have defined. Rows can be reordered by dragging, and it suggests conventional names per purpose — DATA, VOICE, MGMT, GUEST, IOT, DMZ and so on.

Once the table validates, it generates configuration for Cisco IOS, Cisco NX–OS, Arista EOS, Juniper, HP/Aruba, Dell OS10, Extreme, FortiSwitch and MikroTik, and exports the plan as CSV for change documentation. Read the output before you paste it — it is a starting scaffold for a switch, not a reviewed change.

IPv6, and the cloud templates

Switching the IP version to IPv6 accepts full, compressed and :: notation, then reports the network prefix, prefix length, address type (global unicast, link–local, unique local, multicast and so on), first and last address, total address count, and both the fully expanded and the compressed forms of the address. The expand/compress pair is worth the visit on its own: it settles arguments about whether two differently written addresses are the same address.

The Network Mode selector swaps the standard view for an AWS VPC or Azure VNet template. AWS shows a 10.0.0.0/16 laid out with public, private and database subnets across three availability zones; Azure shows a hub–spoke 10.0.0.0/16 including the fixed–name subnets the platform requires — GatewaySubnet, AzureFirewallSubnet and AzureBastionSubnet, each with its documented minimum size. Both come with the platform's sizing guidance attached. Treat them as a reference layout to copy the shape of, not a design to deploy unread.

Common mistakes and how to recognise them

  • The network address you got back is not the one you typed. That is correct behaviour, not an error. The host bits of your input were masked off. If you expected the address to be preserved, your prefix is longer than you thought.
  • Usable hosts is two fewer than you counted. The network address and the broadcast address are not assignable. A /26 is 64 addresses but 62 usable hosts, so a “60–user” subnet fits and a “64–user” one does not.
  • The exceptions are /31 and /32. A /32 is a single host and the calculator reports one usable address. A /31 is the RFC 3021 point–to–point case where both addresses are usable, and the tool reports two — but the usable–range row is not meaningful at that prefix, so read the network and broadcast rows instead.
  • “Invalid IP address format”. All four octets must be present and each must be 0–255. A trailing dot or a missing octet triggers this.
  • “CIDR must be between 0 and 32”. You are on the IPv4 tab with an IPv6–sized prefix. Switch the IP version selector to IPv6, where the prefix range is 0 to 128.
  • The IP Class row is not what you expected. It reflects the class equivalent of the prefix length — a /8 reads as A, a /16 as B, a /24 or longer as C — rather than being derived from the first octet. Classful addressing has not governed routing for decades; the row is a naming convenience, and the IP Type row (private, public, loopback, link–local) is the one that affects what you can actually do with the address.
  • Your subnets overlap and you did not notice. Paste the whole plan into the CIDR Merger. If the merged output has fewer blocks than you have subnets, some of them overlap or abut — and overlap in an addressing plan is a routing incident waiting to happen.

When to use something else

This calculator answers questions about one prefix at a time and merges lists of prefixes. It does not split a block into a set of variable–sized subnets for you, so if you are doing VLSM design — “fit a 100–host, a 50–host and three 10–host segments into one /24” — you will size each piece here and place them yourself, working from the largest requirement down so the blocks stay aligned. On a live device, ip route, ip addr or show ip interface brief will tell you what is actually configured, which is the question to ask when the calculator's answer and the network's behaviour disagree. And for anything you are about to scan or change, confirm you are authorised to touch it first.

What Is Subnet Calculation

Subnet calculation divides an IP network into smaller, more manageable sub-networks (subnets) by manipulating the subnet mask. Subnetting is fundamental to IP network design, allowing administrators to control broadcast domains, improve security through segmentation, and efficiently allocate IP addresses. Every network engineer, system administrator, and cloud architect needs to understand subnetting.

An IP address has two parts: the network portion (identifying the subnet) and the host portion (identifying the device within that subnet). The subnet mask determines where this boundary falls. A larger network prefix means more subnets with fewer hosts each; a smaller prefix means fewer subnets with more hosts. Getting this calculation right is essential for preventing IP conflicts, optimizing routing, and meeting security requirements.

How Subnetting Works

IPv4 addresses are 32 bits long, written as four octets in dotted decimal notation. The subnet mask (also expressed in CIDR notation) defines the network boundary:

CIDRSubnet MaskNetwork BitsHost BitsUsable Hosts
/24255.255.255.0248254
/25255.255.255.128257126
/26255.255.255.19226662
/27255.255.255.22427530
/28255.255.255.24028414
/29255.255.255.2482936
/30255.255.255.2523022
/16255.255.0.0161665,534

Key formulas:

  • Usable hosts = 2^(host bits) - 2 (subtract network and broadcast addresses)
  • Number of subnets = 2^(borrowed bits)

Example: Splitting 192.168.1.0/24 into four subnets requires borrowing 2 bits (2^2 = 4 subnets), creating /26 subnets with 62 usable hosts each:

  • 192.168.1.0/26 (hosts .1 - .62)
  • 192.168.1.64/26 (hosts .65 - .126)
  • 192.168.1.128/26 (hosts .129 - .190)
  • 192.168.1.192/26 (hosts .193 - .254)

Common Use Cases

  • Network design: Plan IP address allocation for offices, data centers, and cloud VPCs
  • VLAN planning: Assign appropriately sized subnets to different VLANs (servers, workstations, IoT, guests)
  • Cloud networking: Size AWS VPC subnets, Azure virtual networks, and GCP subnetworks
  • Security segmentation: Isolate sensitive systems (databases, management interfaces) into separate subnets with firewall controls
  • Troubleshooting: Verify that devices are on the correct subnet and can communicate with their gateway

Best Practices

  1. Plan for growth — Allocate subnets larger than current needs; re-subnetting a production network is disruptive
  2. Use /30 or /31 for point-to-point links — Router-to-router connections only need 2 addresses; don't waste a /24
  3. Reserve the first and last addresses — The first IP is the network address and the last is the broadcast address; neither is assignable to hosts
  4. Document your IP plan — Maintain a centralized IPAM (IP Address Management) record of all subnets, their purpose, and utilization
  5. Align subnets to bit boundaries — Subnets that align to octet boundaries (/8, /16, /24) are easier to manage and troubleshoot

Frequently Asked Questions

What is subnetting and why is it important?+

Subnetting is the practice of dividing a network into smaller sub-networks (subnets) for better management, security, and efficiency. Key benefits: (1) Efficient IP allocation - Reduces IP waste by sizing subnets to actual needs. (2) Network segmentation - Separates departments, devices, or security zones. (3) Improved performance - Reduces broadcast traffic within smaller networks. (4) Enhanced security - Isolates sensitive systems, limits attack surface. (5) Organized management - Logical network structure mirrors organizational structure. Example: A /24 network (192.168.1.0/24) with 254 hosts can be split into 4 /26 subnets (62 hosts each), allowing separate networks for Sales, Engineering, HR, and Guest WiFi. Modern networks use CIDR (Classless Inter-Domain Routing) instead of the old class-based system (Class A, B, C).

What is CIDR notation and how do I read it?+

CIDR (Classless Inter-Domain Routing) notation is a compact way to represent IP addresses and their routing prefix. Format: IP_ADDRESS/PREFIX_LENGTH. The prefix length (number after /) indicates how many bits are used for the network portion. Examples: 192.168.1.0/24 - /24 means first 24 bits are network (192.168.1), last 8 bits are hosts (0-255), 254 usable hosts. 10.0.0.0/8 - /8 means first 8 bits are network (10), last 24 bits are hosts, 16,777,214 usable hosts (Class A). 172.16.0.0/12 - /12 means first 12 bits are network, 1,048,574 usable hosts. Common Subnet Sizes: /32 - Single host (1 IP), /30 - Point-to-point links (2 usable), /29 - Small subnet (6 usable), /24 - Standard subnet (254 usable), /16 - Large subnet (65,534 usable). The smaller the prefix length, the larger the subnet. /24 is smaller than /16, but /25 is smaller than /24.

How do I calculate subnet masks manually?+

Subnet masks define the network and host portions of an IP address. Manual calculation: Step 1: Convert prefix to subnet mask - /24 → 255.255.255.0 (24 ones, 8 zeros in binary). Step 2: Binary representation - /26 = 11111111.11111111.11111111.11000000 = 255.255.255.192. Step 3: Calculate usable hosts - 2^(host bits) - 2 (subtract network and broadcast addresses). Step 4: Find network boundaries - Network address: IP AND subnet mask, Broadcast: All host bits set to 1, First usable: Network + 1, Last usable: Broadcast - 1. Common Subnet Masks: /30 = 255.255.255.252 (2 usable), /29 = 255.255.255.248 (6 usable), /28 = 255.255.255.240 (14 usable), /27 = 255.255.255.224 (30 usable), /26 = 255.255.255.192 (62 usable), /25 = 255.255.255.128 (126 usable), /24 = 255.255.255.0 (254 usable). Pro tip: Learn common masks by memory for faster network planning.

What are private IP address ranges and when should I use them?+

Private IP address ranges are reserved for internal networks and cannot be routed on the public Internet. Defined in RFC 1918: 10.0.0.0/8 (Class A) - 10.0.0.0 to 10.255.255.255, 16,777,216 addresses, used by large enterprises. 172.16.0.0/12 (Class B) - 172.16.0.0 to 172.31.255.255, 1,048,576 addresses, common in medium organizations. 192.168.0.0/16 (Class C) - 192.168.0.0 to 192.168.255.255, 65,536 addresses, typical for home/small office. When to use: Internal company networks, Home networks, Development/testing environments, Private cloud infrastructure. Connectivity: Devices use NAT (Network Address Translation) to access Internet through a public IP, Multiple devices share one public IP, Provides basic security (not directly accessible from Internet). IPv6 equivalent: fc00::/7 (Unique Local Addresses), but IPv6's massive address space reduces need for private ranges. Always use private IPs internally and reserve public IPs only for Internet-facing services.

What is the difference between network address, broadcast address, and usable IPs?+

Every subnet contains special-purpose addresses: Network Address - First IP in subnet, identifies the network itself (e.g., 192.168.1.0/24 → 192.168.1.0), cannot be assigned to hosts, all host bits are 0, used in routing tables. Broadcast Address - Last IP in subnet, sends packets to all hosts in subnet (e.g., 192.168.1.0/24 → 192.168.1.255), cannot be assigned to hosts, all host bits are 1, used for network-wide announcements. Usable IP Range - All IPs between network and broadcast, can be assigned to hosts/devices (e.g., 192.168.1.0/24 → 192.168.1.1 to 192.168.1.254), total usable = 2^(host bits) - 2. Example: 192.168.1.0/26 - Network: 192.168.1.0, First usable: 192.168.1.1, Last usable: 192.168.1.62, Broadcast: 192.168.1.63, Total usable: 62 hosts. Special case /31 and /32: /32 (single host) - Only one IP, used for loopback or specific host routes. /31 (point-to-point links) - RFC 3021 allows 2 usable IPs without network/broadcast for router links.

How do I subnet a network for multiple departments or VLANs?+

When subnetting for departmentsor VLANs, follow this planning process: Step 1: Determine requirements - How many subnets needed?, Hosts per subnet?, Future growth (add 30-50% capacity). Step 2: Choose subnet size - Sales: 40 users → /26 (62 hosts), Engineering: 100 users → /25 (126 hosts), HR: 15 users → /27 (30 hosts), Guest WiFi: 50 devices → /26 (62 hosts). Step 3: Assign non-overlapping ranges - Sales: 192.168.1.0/26 (192.168.1.1-62), Engineering: 192.168.1.64/25 (192.168.1.65-190), HR: 192.168.1.192/27 (192.168.1.193-222), Guest: 192.168.2.0/26 (192.168.2.1-62). Step 4: Document and implement - Create IP allocation spreadsheet, Configure VLANs on switches, Set up DHCP scopes, Implement inter-VLAN routing, Apply security policies (ACLs). Best practices: Align subnets with VLANs 1:1, Use meaningful VLAN IDs (Sales=VLAN 10), Leave room for growth, Keep documentation updated.

What is VLSM and why is it better than fixed-length subnetting?+

VLSM (Variable Length Subnet Masking) allows using different subnet sizes within the same network, unlike fixed-length subnetting where all subnets are the same size. Traditional Fixed-Length (wasteful): Divide 192.168.1.0/24 into 4 equal /26 subnets (62 hosts each), Small HR department (10 users) wastes 52 IPs, Large Engineering (100 users) doesn't fit. VLSM (efficient): Engineering: 192.168.1.0/25 (126 hosts) - perfect fit, Sales: 192.168.1.128/26 (62 hosts), HR: 192.168.1.192/27 (30 hosts), Management: 192.168.1.224/28 (14 hosts), Point-to-point links: 192.168.1.240/30 (2 hosts each). Benefits: Reduces IP waste, Right-sizes subnets to actual needs, Maximizes address utilization, Essential for ISPs and large organizations. VLSM Rules: Assign largest subnets first, Ensure no overlap, Align subnet boundaries properly (network addresses must fall on subnet boundaries). VLSM requires careful planning but dramatically improves IP efficiency in complex networks.

How does IPv6 subnetting differ from IPv4?+

IPv6 subnetting is simpler but fundamentally different from IPv4 due to the massive address space: Address Space: IPv4: 32 bits (4.3 billion addresses), IPv6: 128 bits (340 undecillion addresses - effectively unlimited). Standard Allocation: IPv4: Organizations receive /8 to /24, conserve carefully, use VLSM and NAT. IPv6: Organizations receive /32 or /48, allocate /64 to every subnet (18 quintillion addresses per subnet!). Subnet Structure: IPv4: Variable subnet sizes (/30 to /8), carefully calculated. IPv6: Almost always /64 for end networks (SLAAC requirement), /48 for organizations (65,536 /64 subnets), /56 for small sites (256 /64 subnets). Key Differences: No broadcast addresses in IPv6 (uses multicast), No NAT needed (every device gets public IP), No need for private ranges (ample public addresses), Simpler subnetting (just assign /64s). Example IPv6 Allocation: ISP gives company 2001:db8:1234::/48, IT creates subnets: Sales: 2001:db8:1234:10::/64, Engineering: 2001:db8:1234:20::/64, WiFi: 2001:db8:1234:30::/64. The simplification comes from abundance - stop conserving and use /64 everywhere.

This tool is provided for informational and educational purposes only. All processing happens in your browser — no data is sent to or stored on our servers. While we strive for accuracy, we make no warranties about the completeness or reliability of results.