Tools / Subnet calculator
Subnet calculator
Try 192.168.1.0/24, 10.0.0.0/8, or an address and mask: 192.168.1.0 255.255.255.0. Calculated in your browser.
192.168.1.0/24
private (RFC 1918)
address11000000.10101000.00000001.00000000netmask11111111.11111111.11111111.00000000network11000000.10101000.00000001.00000000
Working with IPv6? Use the IPv6 subnet calculator.
How to read the results
A subnet is a block of consecutive addresses described by a network address and a prefix length. The calculator turns that into the numbers you configure with.
- Network
- The first address of the block. It names the subnet and is not given to a host, except in a /31 or /32.
- Netmask and wildcard
- The netmask has 1 bits for the network part and 0 bits for the host part. The wildcard mask is its inverse, used in access lists.
- Broadcast
- The last address of an ordinary subnet. Traffic sent to it reaches every host. A /31 and a /32 have none.
- First and last host
- The range you can assign to machines. By convention a router takes the first or the last address.
- Usable hosts
- Total addresses minus the network and broadcast addresses, with the /31 and /32 exceptions.
- Dividing a network
- Choose a longer prefix to cut a block into equal parts. Each extra bit doubles the number of subnets and halves the size of each.
Choose the prefix from the number of hosts you need, rounded up: 50 hosts needs a /26 (62 usable), not a /27 (30).
Questions
How do I calculate the number of hosts in a subnet?
A prefix of /n leaves 32 minus n host bits, so the subnet holds 2 to the power of (32 minus n) addresses. Two of them are reserved on an ordinary subnet, the network address and the broadcast address, so a /24 has 256 addresses and 254 usable hosts. The two exceptions are /31 (2 usable) and /32 (1).
What is the difference between a subnet mask and a wildcard mask?
They are the same mask turned inside out. A /24 netmask is 255.255.255.0; its wildcard mask is 0.0.0.255. Netmasks mark the network bits and are used on interfaces and routes. Wildcard masks mark the bits that may vary and are used in access lists and some routing protocols such as OSPF.
What do /31 and /32 mean?
A /32 is one address: a single host, or a loopback or route to one machine. A /31 holds two addresses and is used for point-to-point links (RFC 3021), where both ends are usable and there is no broadcast address. This calculator follows that rule. Older tools show 0 usable hosts for both.
What happens if I type an address that is not the start of its network?
Typing 192.168.1.77/24 is accepted. The calculator shows the network that address belongs to, 192.168.1.0/24, and says it adjusted the input. Nothing is rejected for having host bits set.
Which IPv4 ranges are private?
10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (RFC 1918) are private and are not routed on the internet. 100.64.0.0/10 is shared address space used by carrier-grade NAT, and 169.254.0.0/16 is link-local. The Type field above tells you which range your block falls in.
Is anything sent to a server?
The maths runs in your browser and nothing is stored. A link you copy carries the address in its URL, like any link. If you want to script it, there is a free endpoint that uses the same code: GET /api/public/tools/subnet?cidr=192.168.1.0/24&split=26. It is rate limited per address.
Planning a network on a VPS? See plans, or check a port once it is up with the port checker.