Skip to the content

Subnet Calculator

Network address, broadcast, host range and mask for an IPv4 address in CIDR notation.

With or without a prefix: 192.168.1.10/24

/24

Network in CIDR notation

192.168.1.0/24

254 usable hosts, from 192.168.1.1 to 192.168.1.254.

Network address
192.168.1.0
Broadcast address
192.168.1.255
First usable host
192.168.1.1
Last usable host
192.168.1.254
Usable hosts
254
Total addresses
256
Subnet mask
255.255.255.0
Wildcard mask
0.0.0.255
IP class
C, default mask /24
Address type
Private (RFC 1918), in 192.168.0.0/16

In binary

Address
11000000.10101000.00000001.00001010
Mask
11111111.11111111.11111111.00000000
Network
11000000.10101000.00000001.00000000
Broadcast
11000000.10101000.00000001.11111111

The line marks where the network part ends: 24 network bits to its left, 8 host bits to its right.

Split into smaller subnets

4 subnets of /26, 62 usable hosts each.

  1. 192.168.1.0/26Hosts 192.168.1.1 – 192.168.1.62Broadcast 192.168.1.63
  2. 192.168.1.64/26Hosts 192.168.1.65 – 192.168.1.126Broadcast 192.168.1.127
  3. 192.168.1.128/26Hosts 192.168.1.129 – 192.168.1.190Broadcast 192.168.1.191
  4. 192.168.1.192/26Hosts 192.168.1.193 – 192.168.1.254Broadcast 192.168.1.255
Share this tool:TwitterFacebookLinkedInWhatsAppEmail

What the number after the slash means

An IPv4 address is 32 bits. The prefix length says how many of them, counted from the left, name the network. The rest name a host inside it. In 192.168.1.10/24 the first 24 bits (192.168.1) are the network and the last 8 (the 10) are the host.

Each bit that moves from the host part to the network part halves the network: a /24 holds 256 addresses, a /25 holds 128, a /26 holds 64. The size is always 2 to the power of (32 − prefix).

Reading a subnet mask

The mask is the prefix written another way: a 1 for every network bit and a 0 for every host bit, shown as four decimal numbers. /24 is 24 ones and 8 zeros, or 255.255.255.0.

Because the ones always come first, a mask can only contain the numbers 0, 128, 192, 224, 240, 248, 252, 254 and 255. Something like 255.0.255.0 is not a mask. The wildcard mask is the same thing with every bit flipped (0.0.0.255 for a /24), which is the form Cisco access lists use.

A worked example: 192.168.1.130/26

A /26 leaves 6 host bits, so every network holds 2⁶ = 64 addresses and the networks start at multiples of 64: .0, .64, .128 and .192. The address 130 falls in the block that starts at 128.

Last number in binaryAddress
The address10 000010192.168.1.130
Network: host bits all 010 000000192.168.1.128
Broadcast: host bits all 110 111111192.168.1.191

That leaves 192.168.1.129 to 192.168.1.190 for devices: 62 addresses.

Why two addresses go missing

The address with all host bits 0 names the network itself. The one with all host bits 1 is the broadcast address, which reaches every host in the subnet at once. Neither can be given to a device, so a subnet has two usable addresses fewer than its size.

Two sizes are exceptions:

  • A /31 has only two addresses. On a link between two routers a network and a broadcast address are of no use, so RFC 3021 allows both to be used as hosts.
  • A /32 is one address: a single host in a firewall rule or a route.

Private ranges

RFC 1918 sets three ranges aside for private networks. Anyone may use them, and they are not routed on the internet.

RangeFirst addressLast address
10.0.0.0/810.0.0.010.255.255.255
172.16.0.0/12172.16.0.0172.31.255.255
192.168.0.0/16192.168.0.0192.168.255.255

The middle one is the one people get wrong. It ends at 172.31, so 172.32.0.1 is a public address.

The calculator also names loopback (127.0.0.0/8), link-local (169.254.0.0/16, what a computer assigns itself when no DHCP server answers), the range providers use for carrier-grade NAT (100.64.0.0/10), multicast and the reserved blocks.

The class

Until 1993 the first bits of an address fixed the size of its network: class A was /8, class B /16 and class C /24. Classless routing (CIDR) replaced that with the prefix length. The class is shown because courses and exams still ask for it. It no longer decides anything.