IPv4 subnet calculator

Everything about a CIDR block, and how to split it.

loading IPv4 subnet calculator
About this tool

What is a subnet calculator?

A subnet calculator (also called an IP calculator or CIDR calculator) takes an IP address and a mask and tells you everything that follows from them: which network the address belongs to, where that network starts and ends, how many devices fit in it and which addresses are reserved. Network engineers, sysadmins, cloud architects and students use it to plan VPCs, size VLANs, write firewall rules and prepare for networking exams.

The mask can be written as a prefix length (/24, CIDR notation, defined in RFC 4632) or as a dotted netmask (255.255.255.0). Both mean the same thing: the first 24 bits identify the network and the remaining 8 bits identify the host. This calculator reads either form, plus a single address (treated as a /32) and IPv6 blocks such as 2001:db8::1/64.

For each input it shows the network address, netmask in decimal and binary, wildcard mask (used by Cisco ACLs and OSPF), first and last usable address, broadcast address, number of usable hosts, the class and the kind of address (private under RFC 1918, carrier-grade NAT, loopback, link-local, documentation range, multicast or public). It can also test whether an address or block sits inside the network and split the block into smaller subnets. Everything is calculated in your browser; the addresses you type are never sent anywhere.

How to calculate a subnet

  1. Type or paste an address with its mask in the main field: CIDR (192.168.0.1/24), address plus netmask (192.168.0.1 255.255.255.0), a bare address or an IPv6 block. The page opens with an example already filled in.
  2. Read the result table. Each row has a copy button; there is also a button to copy every row at once.
  3. To move along the address space, use the previous block and next block buttons, which jump to the neighbouring subnet of the same size.
  4. To check membership, type an address or a block in the "is this inside the network?" field. The answer says yes or no and names both sides.
  5. To plan subnets, use the split option: choose how many subnets you want. If the number is not a power of two, the tool rounds up to the next power of two and tells you so.
  6. Copy the list of subnets and paste it into your documentation, Terraform file or router configuration.

Examples

A host inside a /26

Input 192.168.10.37/26. A /26 has 64 addresses, so the block containing .37 is the first one, starting at .0:

Network address : 192.168.10.0
Netmask         : 255.255.255.192
Wildcard        : 0.0.0.63
First / last    : 192.168.10.1 - 192.168.10.62
Broadcast       : 192.168.10.63
Usable hosts    : 62

Large private network

10.0.0.0/8 has 2^24 = 16,777,216 addresses and 16,777,214 usable hosts, with netmask 255.0.0.0. It belongs to the private range of RFC 1918, so it is not routable on the internet.

Split a /24 into four

Splitting 192.168.0.0/24 into 4 subnets gives four /26 blocks of 64 addresses:

192.168.0.0/26
192.168.0.64/26
192.168.0.128/26
192.168.0.192/26

Point-to-point links: /30, /31 and /32

A /30 has 4 addresses and 2 usable hosts. A /31 has 2 addresses and both are usable on point-to-point links (RFC 3021), so the tool reports no broadcast address. A /32 is a single host.

IPv6

2001:db8::/32 is the documentation prefix and holds 2^96 = 79,228,162,514,264,337,593,543,950,336 addresses. A typical site gets a /48, and each LAN uses a /64, which holds 2^64 = 18,446,744,073,709,551,616 addresses.

Common mistakes

  • Counting the network and broadcast addresses as hosts. In a /24 the usable hosts are 254, not 256. The first address names the network and the last one is the broadcast (except on /31 and /32).
  • Writing a non-contiguous netmask, such as 255.0.255.0. A valid mask is a run of 1 bits followed only by 0 bits, and the tool rejects it with an explanation.
  • Prefix out of range. IPv4 prefixes go from 0 to 32, IPv6 from 0 to 128.
  • Using the wildcard mask where a netmask is expected. 0.0.0.255 is the wildcard of a /24, not a netmask.
  • Typing an address with a leading zero such as 192.168.010.1: some systems read 010 as octal.
  • Assuming 100.64.0.0/10 is private. It is the carrier-grade NAT range (RFC 6598) and is shown as such.

Frequently asked questions

How many hosts fit in a /24?

A /24 has 256 addresses and 254 usable hosts. In general the usable count is 2^(32 − prefix) − 2.

What is the difference between a subnet mask and a wildcard mask?

The wildcard mask is the netmask with every bit flipped. For 255.255.255.0 the wildcard is 0.0.0.255. Access lists and OSPF network statements use the wildcard form.

What are the private IPv4 ranges?

10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (RFC 1918). The tool labels addresses in these blocks as private use.

Does this calculator work for IPv6?

Yes. Enter an address with a prefix from 0 to 128. It shows the expanded and compressed forms (RFC 5952), the reverse DNS name and the number of addresses.

How do I convert an address range to CIDR blocks?

Use the IPv4 range expander. To see the same address as an integer, hex or binary, use the IPv4 address converter.

Can I generate an IPv6 private network?

Yes, the IPv6 ULA generator creates a random fd00::/8 prefix following RFC 4193.

Report a problem