Subnet calculator

Enter a network in CIDR notation, an address with a netmask or an IPv6 prefix. The calculator shows the network, mask, first and last host address, broadcast and number of addresses.

Result: 192.168.1.0/24

Network
192.168.1.0
Prefix length
/24
Netmask
255.255.255.0
Wildcard mask
0.0.0.255
Broadcast
192.168.1.255
First usable address
192.168.1.1
Last usable address
192.168.1.254
Number of addresses
256
Usable host addresses
254
Address type
Private (RFC 1918)
Class (historical)
C
Reverse DNS zone
1.168.192.in-addr.arpa
Binary (network)
11000000.10101000.00000001.00000000
Binary (netmask)
11111111.11111111.11111111.00000000

Split into /25

NetworkFirst usable addressLast usable address
192.168.1.0/25192.168.1.1192.168.1.126
192.168.1.128/25192.168.1.129192.168.1.254

Split into /26

NetworkFirst usable addressLast usable address
192.168.1.0/26192.168.1.1192.168.1.62
192.168.1.64/26192.168.1.65192.168.1.126
192.168.1.128/26192.168.1.129192.168.1.190
192.168.1.192/26192.168.1.193192.168.1.254

What is a subnet?

A subnet is a block of contiguous IP addresses that belong to the same local network. Machines in the same subnet talk to each other directly, while traffic to other subnets goes through a router – often called the gateway or default gateway.

The size of a subnet is set by the prefix length, written after the slash in CIDR notation. 192.168.1.0/24 means the first 24 bits of the address are the network part and the last 8 bits the host part. With 8 host bits the network has 2⁸ = 256 addresses.

Netmask, wildcard and prefix

The netmask is the same as the prefix length written as an IP address: 24 ones followed by 8 zeros becomes 255.255.255.0. The wildcard mask is the inverse (0.0.0.255) and is used in access lists on Cisco equipment and in OSPF, among others.

NotationExampleUsed in
CIDR10.20.0.0/22Documentation, routing, most modern tools
Netmask255.255.252.0Network adapters, DHCP, older equipment
Wildcard0.0.3.255ACLs and OSPF on Cisco and similar

Network address, broadcast and usable hosts

In IPv4 the first address in a subnet is the network address and the last is the broadcast address. Neither can be used by a machine, so a /24 has 254 usable addresses, from .1 to .254. It is common practice to give the router the first usable address (.1).

Two exceptions: a /31 has two addresses that can both be used, and is the standard for point-to-point links between routers (RFC 3021). A /32 is a single address, typically a loopback or a host route.

How do I calculate a subnet by hand?

  1. Find the block size: 2^(32 − prefix). For a /26 that is 2⁶ = 64.
  2. Networks start at whole multiples of the block size in the octet where the prefix ends: .0, .64, .128, .192.
  3. The address 192.168.10.77/26 falls in the block starting at .64. Network: 192.168.10.64, broadcast: 192.168.10.127.
  4. Usable hosts are everything in between: .65 to .126 – 62 addresses.

Private addresses

Internally most networks use private addresses from RFC 1918: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. These are not routed on the internet and can be used freely. Consider a less common range than 192.168.0.0/24 and 192.168.1.0/24 – that avoids clashes when staff connect over VPN from home. Read more in the network segmentation guide.

IPv6

The calculator accepts IPv6 prefixes too. IPv6 has no broadcast, and a normal LAN is always a /64. To split a /48 or /56 into /64s, use the IPv6 subnet calculator.

IPv4 prefix reference

Every prefix length from /8 to /32 with netmask, wildcard and number of addresses. Usable hosts are two fewer than addresses, because the network and broadcast addresses cannot be assigned to a machine – except /31 (point-to-point, RFC 3021) and /32 (a single host).

PrefixNetmaskWildcardAddressesUsable hosts
/8255.0.0.00.255.255.25516,777,21616,777,214
/9255.128.0.00.127.255.2558,388,6088,388,606
/10255.192.0.00.63.255.2554,194,3044,194,302
/11255.224.0.00.31.255.2552,097,1522,097,150
/12255.240.0.00.15.255.2551,048,5761,048,574
/13255.248.0.00.7.255.255524,288524,286
/14255.252.0.00.3.255.255262,144262,142
/15255.254.0.00.1.255.255131,072131,070
/16255.255.0.00.0.255.25565,53665,534
/17255.255.128.00.0.127.25532,76832,766
/18255.255.192.00.0.63.25516,38416,382
/19255.255.224.00.0.31.2558,1928,190
/20255.255.240.00.0.15.2554,0964,094
/21255.255.248.00.0.7.2552,0482,046
/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
/32255.255.255.2550.0.0.011

Get your IP addresses under control today

Free for up to 100 IP addresses. Sign-in details by email immediately, no credit card.

IPv4 and IPv6 subnet calculator – netmask, broadcast and hosts | ipmanager.no