IPv4 subnet calculator (CIDR)

A /24 IPv4 subnet holds 256 addresses, 254 of them usable by hosts, and every extra prefix bit halves that. Enter an address with a prefix or a netmask to get the network and broadcast addresses, the usable range, the wildcard mask and the host count.

Write the prefix after a slash (/24), or the netmask after a slash or a space (255.255.255.0).

Lists the subnets of the size you pick that fit inside this network.

Network

192.168.1.0/24

254 usable hosts · 256 addresses

Network address
192.168.1.0
Broadcast address
192.168.1.255
Netmask
255.255.255.0
Wildcard mask
0.0.0.255
First usable host
192.168.1.1
Last usable host
192.168.1.254
Usable hosts
254
Total addresses
256
Address range
192.168.1.0 – 192.168.1.255
Address type
Private-use (RFC 1918)
Address in binary
11000000.10101000.00000001.00001010the first 24 bits are the network, the other 8 the host
Netmask in binary
11111111.11111111.11111111.00000000
Network in CIDR notation
192.168.1.0/24

How do you calculate a subnet from CIDR notation?

The prefix after the slash says how many leading bits of the address name the network; the remaining bits number the hosts. A /24 keeps 24 network bits and leaves 8 host bits, so it holds 2⁸ = 256 addresses, and its netmask is 24 one-bits followed by 8 zero-bits: 255.255.255.0.

The network address is the address with every host bit set to 0, and the broadcast address has every host bit set to 1. Neither can be given to a host, so a subnet has 2 fewer usable addresses than its size: 254 in a /24 and 2 in a /30. A /31 is the exception, because RFC 3021 lets a point-to-point link use both of its addresses, and a /32 is one single address.

The wildcard mask is the netmask with every bit flipped, 0.0.0.255 for a /24; router access lists use it to mark the bits that may vary. The calculator also says whether the address sits in a range set aside for a special purpose, such as private-use 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 from RFC 1918, or 100.64.0.0/10 for carrier-grade NAT; anything outside those ranges is labelled public.

addresses = 2^(32 − prefix)
usable hosts = addresses − 2   (/31 = 2, /32 = 1)
network = address AND netmask
broadcast = network OR wildcard mask

How many hosts are in each subnet size?

IPv4 prefix lengths /8 to /32 with their netmask, wildcard mask, total addresses and usable hosts
PrefixNetmaskWildcard maskAddressesUsable 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 (point-to-point, RFC 3021)
/32255.255.255.2550.0.0.011 (single host)

How to calculate an IPv4 subnet

  1. 1
    Enter the address and its sizeType an IPv4 address with a prefix, like 192.168.1.10/24, or with a netmask, like 192.168.1.10 255.255.255.0.
  2. 2
    Read the networkThe result gives the network and broadcast addresses, the first and last usable host, and how many hosts fit.
  3. 3
    Copy the masksCopy the netmask, the wildcard mask or the network in CIDR notation for your router or cloud network settings.
  4. 4
    Split it if you need toPick a longer prefix under “Split it into smaller subnets” to list the subnets of that size inside the network.

Frequently asked questions

How many usable hosts are in a /24, /27 or /30 subnet?
A /24 has 254 usable hosts out of 256 addresses, a /27 has 30 out of 32, and a /30 has 2 out of 4. In each case the first address names the network and the last is the broadcast address.
Why are two addresses subtracted from every subnet?
The address with all host bits 0 identifies the network and the one with all host bits 1 is the broadcast address; RFC 1122 says neither may be given to a host. A /31 point-to-point link (RFC 3021) and a single /32 address are the only exceptions.
What is a wildcard mask?
It is the netmask inverted: 1 bits mark the positions that may vary and 0 bits the ones that must match, so 255.255.255.0 becomes 0.0.0.255. Router access-control lists, such as Cisco's, take wildcard masks instead of netmasks.
Are IP address classes A, B and C still used?
No. Classless Inter-Domain Routing (CIDR) replaced the class A, B and C system, and RFC 4632 describes networks by prefix length instead. That is why this calculator shows a prefix such as /24 and not a class.
Which IPv4 address ranges are private?
RFC 1918 sets aside 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks, and routes to them are not passed between organisations on the internet. 100.64.0.0/10 looks similar but is shared space for internet providers' carrier-grade NAT (RFC 6598), not for your own network.

Sources

Related tools

See all 73 free tools

Need a custom dev tool for your team?

We build internal tools, dashboards, APIs, and SaaS platforms. If you can describe it, we can ship it.

Built by CountryDevs · No signup · No ads · We count visits, never what you enter