acalculator

What is my subnet range?

Type an IPv4 address and pick a subnet mask, or type both as 192.168.1.10/24, to see the whole subnet.

Your numbers

Usable host range
192.168.1.1 – 192.168.1.254

192.168.1.0/24 has 254 usable hosts: 192.168.1.1 – 192.168.1.254.

Usable hosts
254
Network address
192.168.1.0
Broadcast address
192.168.1.255
CIDR notation
192.168.1.0/24
Total addresses
256
Subnet mask
255.255.255.0
Wildcard mask
0.0.0.255
Subnet mask in binary
11111111 11111111 11111111 00000000
Address class
C
Address type
Private

Usable host range: 192.168.1.1 – 192.168.1.254. 192.168.1.0/24 has 254 usable hosts: 192.168.1.1 – 192.168.1.254.

How to calculate

Computes an IPv4 subnet from an address and a prefix length: network and broadcast addresses, usable host range and count, subnet and wildcard masks, class, and address type.

Example with the default inputs (IP address 192.168.1.10, Subnet mask /24 (255.255.255.0)): 192.168.1.0/24 has 254 usable hosts: 192.168.1.1 – 192.168.1.254.

Method: network = address AND mask; broadcast = network OR NOT mask; hosts = 2^(32 − prefix) − 2 (2 for /31, 1 for /32).

  • IPv4 only. Each part of the address is a whole number from 0 to 255, written without leading zeros.
  • The network and broadcast addresses are not usable hosts, except in a /31 (RFC 3021) and a /32.
  • The address class is historical (classful addressing, replaced by CIDR in 1993) and shown for reference.

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. IP address 192.168.1.10, Subnet mask /24 (255.255.255.0) gives Usable host range 192.168.1.1 – 192.168.1.254, Usable hosts 254, Network address 192.168.1.0, Broadcast address 192.168.1.255, CIDR notation 192.168.1.0/24, Total addresses 256, Subnet mask 255.255.255.0, Wildcard mask 0.0.0.255, Subnet mask in binary 11111111 11111111 11111111 00000000, Address class C, Address type Private.Source: hand calculation in content.mdx (RFC 4632 prefix, RFC 950 all-zeros and all-ones host numbers, RFC 1918 private block); Python ipaddress module (ip_network, strict off)
  2. IP address 10.20.30.40/13 gives Usable host range 10.16.0.1 – 10.23.255.254, Usable hosts 524,286, Network address 10.16.0.0, Broadcast address 10.23.255.255, Subnet mask 255.248.0.0, Wildcard mask 0.7.255.255, Address class A, Address type Private.Source: hand calculation in content.mdx: second number 20 = 00010100, keep 5 bits → 16; 2^19 − 2 = 524,286; Python ipaddress module (ip_network, strict off)
  3. IP address 172.16.5.4, Subnet mask /31 (255.255.255.254) gives Usable host range 172.16.5.4 – 172.16.5.5, Usable hosts 2, Network address 172.16.5.4, Total addresses 2.Source: RFC 3021: both addresses of a /31 are host addresses; the hosts of 172.16.5.4/31 in the Python ipaddress module
  4. IP address 203.0.113.77, Subnet mask /32 (255.255.255.255) gives Usable host range 203.0.113.77, Usable hosts 1, CIDR notation 203.0.113.77/32, Address type Documentation.Source: hand calculation in content.mdx: a /32 is a single host; RFC 5737 TEST-NET-3 is 203.0.113.0/24
  5. IP address 192.168.1.200, Subnet mask /26 (255.255.255.192) gives Usable host range 192.168.1.193 – 192.168.1.254, Usable hosts 62, Total addresses 64, Network address 192.168.1.192, Subnet mask 255.255.255.192, Wildcard mask 0.0.0.63.Source: hand calculation in content.mdx: 2^(32 − 26) = 64 addresses, 64 − 2 = 62 hosts; 200 = 11001000, keep 2 bits → 192

How it works

An IPv4 address is a 32-bit number, written as four numbers from 0 to 255 (8 bits each) separated by dots. A prefix length p from 0 to 32 (RFC 4632) says the first p bits are the network and the other 32 − p bits number the hosts.

  • Subnet mask: p ones followed by 32 − p zeros, written in the same dotted form. /24 is 255.255.255.0.
  • Wildcard mask: the mask with every bit flipped; each part is 255 minus the mask's part.
  • Network address: the address AND the mask, which sets every host bit to 0.
  • Broadcast address: the network address OR the wildcard mask, which sets every host bit to 1. A /31 or /32 has no broadcast address.
  • Total addresses: 2^(32 − p).
  • Usable hosts: 2^(32 − p) − 2, because the network and broadcast addresses are not given to hosts (RFC 950). A /31 has 2 usable hosts, both of its addresses (RFC 3021), and a /32 has 1.
  • Usable host range: from the network address + 1 to the broadcast address − 1. For a /31 it is both addresses, and for a /32 it is the address itself.
  • CIDR notation: the network address, a slash, and p.
  • Subnet mask in binary: the mask as four groups of 8 bits separated by spaces, such as 11111111 11111111 11111111 00000000 for /24.
  • Address class (historical, RFC 791): by the first number of the address, A is 0 to 127, B is 128 to 191, C is 192 to 223, D (multicast) is 224 to 239, and E (reserved) is 240 to 255.
  • Address type: the first block in this list that holds the address, or Public if none does:
BlockType
255.255.255.255/32Limited broadcast
0.0.0.0/8This network
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16Private (RFC 1918)
100.64.0.0/10Shared (carrier-grade NAT) (RFC 6598)
127.0.0.0/8Loopback
169.254.0.0/16Link-local (RFC 3927)
192.0.0.0/24IETF protocol assignments
192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24Documentation (RFC 5737)
198.18.0.0/15Benchmarking (RFC 2544)
224.0.0.0/4Multicast (RFC 5771)
240.0.0.0/4Reserved

Assumptions

  • IPv4 only. Each of the four parts must be a whole number from 0 to 255 written without leading zeros (192.168.1.10, not 192.168.001.010), because some systems read a leading zero as octal.
  • You can type the prefix after the address (10.20.30.40/13). Then the subnet mask field is hidden and the typed prefix is used. The prefix must be a whole number from 0 to 32 without leading zeros.
  • The address type and class describe the address you typed, not the network.

Worked examples by hand

192.168.1.10 with mask /24 (the default). The mask is 24 ones, 255.255.255.0, so the first three numbers are the network part. The network address is 192.168.1.0 and the broadcast address is 192.168.1.255. There are 2⁸ = 256 addresses and 256 − 2 = 254 usable hosts, from 192.168.1.1 to 192.168.1.254. The wildcard mask is 0.0.0.255. The first number, 192, makes it class C, and 192.168.0.0/16 makes it Private.

10.20.30.40/13. The mask is 13 ones: 8 in the first part and 5 in the second, 11111000 = 248, so the mask is 255.248.0.0. The second number is 20 = 00010100 in binary; keeping its first 5 bits gives 00010000 = 16, so the network address is 10.16.0.0. The host bits set to 1 give 00010111 = 23 in the second part and 255 after it: the broadcast address is 10.23.255.255. There are 2¹⁹ = 524,288 addresses and 524,286 usable hosts, from 10.16.0.1 to 10.23.255.254.

172.16.5.4/31. Only the last bit is a host bit, so the subnet holds 172.16.5.4 and 172.16.5.5. Under RFC 3021 both are hosts: 2 usable hosts, no broadcast address.

203.0.113.77/32. Every bit is a network bit, so the subnet is the single host 203.0.113.77. It is in 203.0.113.0/24, a Documentation block.

192.168.1.200/26. 32 − 26 = 6 host bits give 2⁶ = 64 addresses and 64 − 2 = 62 usable hosts. The mask is 26 ones: 255.255.255 and then 11000000 = 192, so 255.255.255.192, and the wildcard mask is 0.0.0.63. The last number, 200 = 11001000, keeps its first 2 bits: 11000000 = 192. The network address is 192.168.1.192, the broadcast address is 192.168.1.255, and the hosts run from 192.168.1.193 to 192.168.1.254.

Other questions people ask

How do I find the network address of a subnet?

Write the address and the subnet mask in binary and keep only the bits where the mask has a 1 (a bitwise AND). For 192.168.1.10 with mask 255.255.255.0, the first three numbers stay and the last becomes 0, so the network address is 192.168.1.0.

How many usable hosts are in a /24?

A /24 leaves 32 − 24 = 8 host bits, so it has 2⁸ = 256 addresses. The first is the network address and the last is the broadcast address, which leaves 256 − 2 = 254 usable host addresses.

What does the number after the slash mean?

It is the prefix length in CIDR notation: how many of the 32 bits of the address belong to the network. /24 means the first 24 bits, which is the mask 255.255.255.0. The remaining bits number the hosts inside the subnet.

What is a wildcard mask?

It is the subnet mask with every bit flipped, so each part is 255 minus the matching part of the mask. The /24 mask 255.255.255.0 has the wildcard mask 0.0.0.255. Cisco access lists and OSPF use wildcard masks to say which bits must match.

Why does a /31 have 2 usable hosts?

A /31 has only 2 addresses. Under the old rule it would have 0 usable hosts, which wastes both. RFC 3021 lets point-to-point links use both addresses as hosts, with no network or broadcast address, so the calculator counts 2.

Which IP addresses 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. These addresses are not routed on the public internet. The calculator also names other special blocks, such as loopback (127.0.0.0/8) and link-local (169.254.0.0/16).

Are IP address classes still used?

Not for routing. Classes A, B, and C fixed the network size by the first number of the address. CIDR replaced them in 1993 so networks could be any prefix length. The class is still taught and shown here for reference.