calculate subnet for ip

IPv4 Subnet Calculator

Enter an IPv4 address and either a CIDR prefix (like /24 or 24) or subnet mask (like 255.255.255.0).

Supports CIDR 0-32 and contiguous subnet masks.

Why people need to calculate subnet for ip

When you calculate subnet for ip addresses, you are deciding how a network is split into smaller, manageable pieces. This matters for security, performance, and organization. Whether you are setting up office VLANs, cloud VPC ranges, home labs, or troubleshooting DHCP issues, subnetting helps you know exactly where devices belong.

A proper subnet calculation gives you core details immediately:

  • Network address
  • Broadcast address
  • First and last usable host
  • Total addresses and usable host count
  • Subnet mask, wildcard mask, and CIDR prefix

What subnetting means in plain language

An IPv4 address has 32 bits. A subnet mask (or CIDR prefix) tells you which bits represent the network and which bits represent hosts. For example, in 192.168.1.34/24, the first 24 bits define the network, and the remaining 8 bits are for host addresses.

The key idea: devices are in the same subnet when their network portion matches. Routers are needed to move between different subnets.

Step-by-step method to calculate subnet for ip

1) Identify the address and prefix

Suppose we start with 10.20.30.140/26. A /26 means 26 network bits and 6 host bits.

2) Convert CIDR to subnet mask

/26 becomes 255.255.255.192. That last octet (192) creates block sizes of 64 in the final octet: 0, 64, 128, 192.

3) Find the network boundary

The IP has last octet 140, which falls in the 128-191 block. So the network address is 10.20.30.128.

4) Find broadcast and host range

The broadcast address is the last address in that block: 10.20.30.191. Usable hosts run from 10.20.30.129 to 10.20.30.190.

5) Calculate host count

With 6 host bits, total addresses are 2^6 = 64. For most subnets, usable hosts are 64 - 2 = 62 (subtract network and broadcast).

CIDR quick guide

  • /24: 256 total, 254 usable (common LAN)
  • /25: 128 total, 126 usable
  • /26: 64 total, 62 usable
  • /27: 32 total, 30 usable
  • /28: 16 total, 14 usable
  • /29: 8 total, 6 usable
  • /30: 4 total, 2 usable (legacy point-to-point)
  • /31: 2 total, 2 usable on point-to-point links (RFC 3021)
  • /32: single host route

Common subnet calculation mistakes

  • Mixing mask formats: treating 255.255.255.0 and /24 as different sizes (they are equivalent).
  • Using non-contiguous masks: subnet masks must be continuous 1-bits followed by continuous 0-bits.
  • Forgetting special cases: /31 and /32 behave differently than regular subnets.
  • Confusing network with host: first and last addresses are reserved in normal subnets.

Private IPv4 ranges to remember

If your goal is internal networking, private ranges are usually best:

  • 10.0.0.0/8
  • 172.16.0.0/12
  • 192.168.0.0/16

These are not routable directly on the public internet and are commonly NATed behind public addresses.

Practical planning tips

Use VLSM for efficient allocation

Variable Length Subnet Masking (VLSM) lets you assign larger subnets to busy segments and smaller ones to low-device segments. This reduces wasted addresses and keeps growth manageable.

Document everything

Keep records of subnet purpose, VLAN ID, gateway IP, DHCP scope, and reserved addresses. Good subnet design is only useful when your team can read and maintain it.

Final takeaway

To calculate subnet for ip correctly, you only need two inputs: the IP and the mask/prefix. From there, you can derive every meaningful network boundary. Use the calculator above for quick answers, then verify with your network design policy and routing plan before deployment.

🔗 Related Calculators