IP Subnet Calculator

Compute the IPv4 network address in CIDR form from an address and prefix length.

IP Subnet Calculator

Formula

network = ip_numeric AND mask(cidr); result = dotted(network) + "/" + cidr

Converts the IPv4 address to a 32 bit integer, applies the CIDR mask, converts back to dotted quad, and appends the prefix.

Enter an IPv4 address and a CIDR prefix to get the network address, broadcast address and number of usable hosts. A /n prefix leaves 32 − n host bits, so the block has 2^(32 − n) addresses and 2^(32 − n) − 2 usable hosts, because the network and broadcast addresses are reserved. Example: 192.168.1.10/26 has mask 255.255.255.192, network 192.168.1.0, broadcast 192.168.1.63 and 62 usable hosts (192.168.1.1–192.168.1.62). Exceptions: a /31 point-to-point link has 2 usable addresses (RFC 3021) and a /32 is a single host.

This IP subnet calculator returns the IPv4 network address, broadcast address and usable host count for an IP and CIDR prefix. Enter a dotted quad and a prefix length to see the network in address/prefix form.

Network students and admins use it to confirm which subnet an interface address belongs to before writing routes or firewall rules. It shows the network ID, broadcast address and usable host count, not a full inventory of every host.

How the network ID is found

The tool converts the IP to a 32 bit number, builds a mask from the CIDR length, bitwise ANDs them, converts back to dotted decimal, and appends /cidr.

Worked example

IP 192.168.1.10, CIDR 24. Network result is 192.168.1.0/24.

InputValue
IPv4 address192.168.1.10
CIDR prefix24
Network192.168.1.0/24

How to use the fields

  • IPv4 address must have four octets from 0 to 255.
  • CIDR prefix is an integer from 1 to 32.
  • Use the prefix that matches the interface mask you were given.

Reading CIDR quickly

/24 keeps the first three octets as the network and leaves 8 host bits. /16 keeps the first two octets. /32 is a single host route. Smaller prefixes mean larger networks and more host addresses.

CIDR to subnet mask table

CIDRSubnet maskWildcardAddressesUsable hosts
/8255.0.0.00.255.255.25516,777,21616,777,214
/12255.240.0.00.15.255.2551,048,5761,048,574
/16255.255.0.00.0.255.25565,53665,534
/20255.255.240.00.0.15.2554,0964,094
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342
/31255.255.255.2540.0.0.122 (point-to-point, RFC 3021)
/32255.255.255.2550.0.0.011 (single host)

Sources: RFC 4632 (CIDR) and RFC 3021 (/31). The tool currently shows 0 hosts for /31 and /32.

Common mistakes

  • Mixing decimal masks like 255.255.255.0 with the wrong CIDR
  • Typing commas or spaces inside the IP
  • Applying IPv4 habits to IPv6 addressing without a different tool

CIDR size intuition

Each step down in prefix length roughly doubles the address space. Moving from /24 to /23 doubles hosts; moving from /24 to /25 halves them. Plan capacity from required hosts plus room for growth, then pick a prefix, then verify the network ID with this calculator on a sample address.

Overlapping subnets cause hard to debug routing problems. Before you add a new VLAN or VPN pool, compute network IDs for both sides and confirm they do not collide.

A /30 is often used on point to point links with only a few addresses. A /29 or /28 may fit a small DMZ. A /24 remains the everyday LAN size in many offices and homes. Enter a host in each of those prefixes once so you build intuition for how the network ID changes when host bits shrink.

Private ranges quick map

Private block (RFC 1918)Range
10.0.0.0/810.0.0.0 – 10.255.255.255
172.16.0.0/12172.16.0.0 – 172.31.255.255
192.168.0.0/16192.168.0.0 – 192.168.255.255

Source: RFC 1918. Home routers often use 192.168.0.0/24 or 192.168.1.0/24. Enter any host in the LAN and /24 to confirm the network ID matches what the router LAN page shows.

When you build a lab with multiple virtual networks, allocate non overlapping prefixes first, then verify each gateway address lands in its own network ID. This calculator makes that verification fast during setup.

Limitations

Results show the network, broadcast and usable host count. They do not list every host or check whether an address is public or private. Use them as a fast network ID check beside your fuller IP plan.

For related unit and percent checks while you plan materials, try the unit converter or the percentage calculator.

Frequently Asked Questions

How many usable hosts are in a /24?

254. A /24 has 256 addresses, and the network and broadcast addresses are reserved.

How many hosts are in a /26 subnet?

64 addresses and 62 usable hosts. The mask is 255.255.255.192.

How do you find the broadcast address?

Set all host bits to 1. For 192.168.1.10/26 the network is 192.168.1.0 and the broadcast is 192.168.1.63.

How many usable addresses does a /31 have?

Two. RFC 3021 allows /31 prefixes on point-to-point links, where no network or broadcast address is needed.

What are the private IPv4 address ranges?

10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, as defined in RFC 1918.