IPv4 Subnet Calculator

Enter an IP address and a mask to get the network address, broadcast address, usable host range, and host count. This subnet calculator also splits a network into smaller subnets.

Updated
Calculated in your browser. No address is looked up online.

You can also type the whole block here, like 10.0.0.0/8.

/26, 255.255.255.192, or wildcard 0.0.0.63

Usable hosts
–
Network (CIDR)
–
Network address
–
Broadcast address
–
First host
–
Last host
–
Subnet mask
–
Wildcard mask
–
Total addresses
–
IP class
–
Address type
–
Address as an integer
–
Binary view (network bits highlighted)
Split into smaller subnets

How to use the IPv4 Subnet Calculator

  1. Type the IP address. You can also paste a whole block, such as 10.20.0.0/14, into this field.
  2. Enter the Mask as a prefix (/26), a netmask (255.255.255.192), or a wildcard mask (0.0.0.63). The results update as you type.
  3. Read the network, broadcast, and host range, or use Split into smaller subnets to divide the block by a number of subnets or by a prefix length.

How it works

An IPv4 address is 32 bits. The prefix length p says how many of them, counted from the left, name the network. The other 32 − p bits number the hosts inside it.

  • Netmask = p one-bits followed by zeros. /26 is 255.255.255.192.
  • Wildcard mask = the netmask with every bit flipped. /26 is 0.0.0.63. Cisco ACLs and OSPF use this form.
  • Network address = address AND netmask.
  • Broadcast address = network OR wildcard.
  • Total addresses = 2^(32 − p). Usable hosts = total − 2, because the network and broadcast addresses can't be given to a device.

Two prefixes are special. A /31 has 2 usable addresses and no broadcast (RFC 3021, for point-to-point links). A /32 is a single host.

Examples

  • 192.168.1.130/26: network 192.168.1.128, broadcast 192.168.1.191, hosts 192.168.1.129 to 192.168.1.190, 62 usable hosts, mask 255.255.255.192.
  • 10.0.0.0/8: 16,777,216 addresses and 16,777,214 usable hosts, class A, private (RFC 1918).
  • 172.16.5.4 with mask 255.255.240.0: that is /20, so the network is 172.16.0.0 and the broadcast is 172.16.15.255, with 4,094 usable hosts.
  • Splitting 192.168.1.0/24 into 4 subnets gives four /26 networks: .0, .64, .128, and .192, each with 62 hosts.

IPv4 subnet cheat sheet

PrefixNetmaskWildcardAddressesUsable hosts
/8255.0.0.00.255.255.25516,777,21616,777,214
/16255.255.0.00.0.255.25565,53665,534
/20255.255.240.00.0.15.2554,0964,094
/22255.255.252.00.0.3.2551,0241,022
/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 (RFC 3021)
/32255.255.255.2550.0.0.011

Limitations

  • A mask must be contiguous: all its one-bits come before its zero-bits. 255.0.255.0 is rejected.
  • Octets with a leading zero, such as 010, are rejected, because some systems read them as octal.
  • The split table lists up to 1,024 subnets. The count above it is always exact.
  • IP classes (A to E) are shown for reference only. Routing has used CIDR since 1993, so the class does not decide the mask.
  • For IPv6 networks, use the IPv6 CIDR Calculator.

Frequently asked questions

How many usable hosts are in a /24?

254. A /24 has 256 addresses, and two of them are reserved: the network address (.0) and the broadcast address (.255).

What is the difference between a subnet mask and a wildcard mask?

They are bit-for-bit opposites. The subnet mask 255.255.255.0 marks the network bits with ones; the wildcard mask 0.0.0.255 marks the host bits with ones. Routers use the wildcard form in access lists and OSPF.

Why does a /31 have 2 usable hosts?

RFC 3021 lets point-to-point links drop the network and broadcast addresses, because only two devices are on the link. That saves two addresses on every router link compared with a /30.

How do I find the network address from an IP and mask?

Do a bitwise AND of the address and the mask. For 192.168.1.130 with mask 255.255.255.192, the last octet is 130 AND 192 = 128, so the network is 192.168.1.128.

Which IPv4 ranges are private?

10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 (RFC 1918). 100.64.0.0/10 is shared address space for carrier-grade NAT. The calculator names the range an address belongs to.

Often used together with the IPv4 Subnet Calculator.