Skip to main content

DigitalCalculators.net

Subnet Calculator

Calculate an IPv4 subnet from an IP address and CIDR prefix or subnet mask: network and broadcast address, usable host range, host count, wildcard mask and binary view.

Results

ItemValue

Binary view

ItemBinary
IPv4 only. Usable hosts exclude the network and broadcast addresses, except for /31 (two-host point-to-point links, RFC 3021) and /32 (a single host). You can also type the IP as 192.168.1.130/26 and the prefix is read from it.

Quick Answer

A subnet is found by ANDing the IP address with the subnet mask. For 192.168.1.130/26, the mask is 255.255.255.192, the network is 192.168.1.128, the broadcast is 192.168.1.191, and the usable hosts are 192.168.1.129 to 192.168.1.190, which is 62 hosts.

Last updated: 3 November 2026 ·How we calculate this: binary AND of the address and the subnet mask

Table of Contents

How This Subnet Calculator Works

Enter an IPv4 address and choose a prefix length, or type the address in CIDR form such as 10.0.5.20/22. The calculator turns the address and mask into 32-bit numbers, keeps the network bits with a binary AND, and sets all host bits to 1 for the broadcast address. It then lists the usable host range, host count, wildcard mask, address type and a binary view.

Quick explanation: the prefix says how many of the 32 bits are the network part.

  • /24: 255.255.255.0, 256 addresses, 254 usable.
  • Network address: all host bits 0.
  • Broadcast address: all host bits 1.

How to Use the Subnet Calculator

  1. Enter an IPv4 address, or an address with /prefix.
  2. Choose the prefix length or subnet mask.
  3. Press Calculate.
  4. Read the network, broadcast and usable host range.
  5. Check the binary view to see the network and host bits.

Core Formulas

  • Network: IP AND mask
  • Broadcast: network OR (NOT mask)
  • Total addresses: 2(32 − prefix)
  • Usable hosts: 2(32 − prefix) − 2, for prefixes up to /30
  • Wildcard mask: 255.255.255.255 − subnet mask

Key Terms

  • Subnet: a smaller network made by splitting a larger IP range.
  • CIDR: Classless Inter-Domain Routing, the /prefix way of writing a network.
  • Subnet mask: a 32-bit number with 1s for the network part of an address.
  • Broadcast address: the last address in a subnet, used to reach all hosts.
  • Usable host: an address that can be given to a device.

Worked Example

Find the subnet for 10.0.5.20/22.

  • Mask: /22 = 255.255.252.0, so the third octet steps by 4
  • 5 falls in the block 4–7, so the network is 10.0.4.0 and the broadcast is 10.0.7.255
  • Usable hosts: 10.0.4.1 to 10.0.7.254, which is 1,022 hosts

Real-Life Examples

  • Home networks: 192.168.1.0/24 gives 254 devices.
  • Office VLANs: split a /24 into four /26 subnets of 62 hosts each.
  • Cloud networks: plan VPC and subnet CIDR blocks without overlaps.
  • Firewall rules: wildcard masks, such as 0.0.0.63 for /26, are used in many access lists.

Subnet Mask vs Wildcard Mask

  • Subnet mask: 1s for network bits, such as 255.255.255.0.
  • Wildcard mask: the opposite, 1s for host bits, such as 0.0.0.255.
  • Use: masks set up interfaces, while wildcard masks are used in many router access lists and routing settings.

Subnet Mask Cheat Sheet

CIDRSubnet maskTotal addressesUsable hosts
/8255.0.0.016,777,21616,777,214
/12255.240.0.01,048,5761,048,574
/16255.255.0.065,53665,534
/20255.255.240.04,0964,094
/22255.255.252.01,0241,022
/23255.255.254.0512510
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242
/31255.255.255.25422
/32255.255.255.25511

Tips for Subnetting

  • Block size: 256 minus the interesting mask octet, such as 256 − 192 = 64 for /26.
  • Private ranges: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 are for internal networks.
  • Point-to-point links: /31 gives two usable addresses with no broadcast.
  • Plan for growth: leave spare addresses in each subnet.

To check a subnet in your head, find the octet where the mask is not 255 or 0 and work out the block size. For /26, the last octet of the mask is 192, so the block size is 64 and subnets start at 0, 64, 128 and 192. An address ending in .130 falls in the block that starts at 128, so its network is .128 and its broadcast is .191, one less than the next block.

Common Mistakes to Avoid

  • Using the network or broadcast address for a device. They are not usable for hosts in normal subnets.
  • Forgetting the −2. A /24 has 256 addresses but 254 usable hosts.
  • Overlapping subnets. 10.0.0.0/23 already includes 10.0.1.0/24.
  • Mixing up mask and wildcard. 255.255.255.0 and 0.0.0.255 are opposites.
  • Picking subnets too small. Leave room for growth.

Frequently Asked Questions

AND the IP address with the subnet mask to get the network address, then set the host bits to 1 for the broadcast.

256 addresses and 254 usable hosts.

255.255.255.192, with 64 addresses and 62 usable hosts.

30 network bits, mask 255.255.255.252, 4 addresses and 2 usable hosts.

RFC 3021 lets /31 subnets be used for point-to-point links with no network or broadcast address.

The inverse of the subnet mask, used in many router and firewall rules.

10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, defined in RFC 1918.

Yes. Type 192.168.1.130/26 and the prefix is read automatically.

No. It supports IPv4 only.

The first address in the subnet, with all host bits set to 0.

An older system (A, B, C) based on the first octet. CIDR replaced it, but the class is shown for reference.

Add bits to the prefix. Each extra bit doubles the number of subnets and halves their size.

References & Sources

SourceUsed ForLink
IETF, RFC 4632: Classless Inter-domain Routing (CIDR) The CIDR addressing and prefix notation standard. https://www.rfc-editor.org/rfc/rfc4632
IETF, RFC 1918: Address Allocation for Private Internets The private IPv4 address ranges. https://www.rfc-editor.org/rfc/rfc1918
IETF, RFC 3021: Using 31-Bit Prefixes on IPv4 Point-to-Point Links Why /31 subnets have two usable addresses. https://www.rfc-editor.org/rfc/rfc3021