Free tool · IPv4 & IPv6 · runs in your browser

Subnet calculator

Enter a CIDR block such as 192.168.1.0/24, an address with a subnet mask, or a range like 10.0.0.5 - 10.0.0.20. You get the network and broadcast address, the usable host range, masks and host counts, and you can split the block into smaller subnets.

Result · IPv4 · CIDR block

192.168.0.0/24

CIDR notation 192.168.0.0/24
Network address 192.168.0.0
Broadcast address 192.168.0.255
First usable host 192.168.0.1
Last usable host 192.168.0.254
Address range 192.168.0.0 - 192.168.0.255
Usable hosts 254
Total addresses 256
Subnet mask 255.255.255.0
Wildcard mask 0.0.0.255
Prefix length /24
Mask in binary 11111111.11111111.11111111.00000000
Network in binary 11000000.10101000.00000000.00000000
Network in hex 0xc0a80000
Network as integer 3232235520
Address class (historic) C
Address type Private network (RFC 1918)
Reverse DNS zone 0.168.192.in-addr.arpa
  • The first address names the network and the last is the broadcast address, so neither is assigned to a host.

Split into /26 subnets

4 subnets of 64 addresses each.

SubnetUsable hostsBroadcastHosts
192.168.0.0/26192.168.0.1 – 192.168.0.62192.168.0.6362
192.168.0.64/26192.168.0.65 – 192.168.0.126192.168.0.12762
192.168.0.128/26192.168.0.129 – 192.168.0.190192.168.0.19162
192.168.0.192/26192.168.0.193 – 192.168.0.254192.168.0.25562

The basics

How CIDR notation works

An IPv4 address is 32 bits, usually written as four numbers from 0 to 255. In CIDR notation such as 192.168.1.0/24, the number after the slash is the prefix length: how many of those bits are the same for every address in the network. The rest are free to number the hosts.

So a /24 leaves 8 host bits, which is 28 = 256 addresses, from 192.168.1.0 to 192.168.1.255. Each extra bit of prefix halves the block: a /25 has 128 addresses, a /26 has 64. The subnet mask says the same thing in dotted form: 24 one-bits make 255.255.255.0.

IPv6 works the same way with 128 bits. A typical site gets a /48 or /56 and gives each LAN a /64.

How to read the result

  • Network address is the first address of the block. It names the subnet and is not given to a device.
  • Broadcast address is the last address. A packet sent to it reaches every host on the subnet, so it is not given to a device either.
  • First and last usable host are the addresses you can assign, for example to your router and your devices. Usable hosts is how many there are: the total minus two.
  • Subnet mask and wildcard mask are the prefix in dotted form, for device settings and for firewall or router access lists.
  • Two sizes break the minus-two rule: a /31 has two usable addresses for a point-to-point link (RFC 3021), and a /32 is a single address.
  • Address type tells you whether the block is public or one of the special ranges, such as private (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), carrier-grade NAT or documentation.

To convert one address between IPv4 and IPv6 forms, use the IPv4 to IPv6 converter. To match addresses against CIDR blocks in your own code, see IP to integer and CIDR matching.

IPv4 CIDR cheat sheet

Every prefix from /8 to /32 with its masks and host counts.

CIDRSubnet maskWildcardAddressesUsable 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

FAQ

Subnetting questions

What is CIDR notation?

CIDR (Classless Inter-Domain Routing) writes a network as an address, a slash and a prefix length, such as 192.168.1.0/24. The prefix length is the number of leading bits that are fixed for the whole network; the remaining bits number the hosts inside it. A /24 fixes 24 of the 32 IPv4 bits, leaving 8 bits, or 256 addresses.

How many hosts are in a /24?

A /24 has 256 addresses. The first (the network address) and the last (the broadcast address) are not given to hosts, so 254 are usable. In general an IPv4 block of prefix n has 2^(32 - n) addresses and 2^(32 - n) - 2 usable hosts, except /31 and /32.

Why does a /31 have 2 usable hosts?

A /31 has only two addresses. RFC 3021 lets point-to-point links use both, because a link between exactly two routers needs neither a network nor a broadcast address. A /32 is a single address, used for loopbacks and host routes.

What is a wildcard mask?

A wildcard mask is the inverse of the subnet mask: 0 bits must match and 1 bits can be anything. For 255.255.255.0 the wildcard mask is 0.0.0.255. Cisco access lists and OSPF configuration use wildcard masks.

Why is /64 the usual IPv6 subnet size?

IPv6 splits an address into a 64-bit network part and a 64-bit interface identifier. Stateless address autoconfiguration (SLAAC) and several other features expect that split, so a LAN is almost always a /64. Sites typically get a /48 or /56 to divide into /64s.

How do I turn an IP range into CIDR blocks?

Enter the range with a dash, such as 10.0.0.5 - 10.0.0.20. The calculator returns the smallest list of CIDR blocks that covers exactly those addresses, which is what most firewalls and access lists need.