IPv4 Subnet Calculator
Calculate network address, broadcast, host range, and mask from an IP/CIDR.
What is IPv4 Subnet Calculator?
A subnet calculator takes an IPv4 address in CIDR notation, applies the mask, and derives the network address, broadcast address, subnet mask in dotted decimal, the first and last usable host addresses, and the total number of host addresses inside the block. IPv4 is defined in RFC 791 and Classless Inter-Domain Routing in RFC 4632, which together set the rules a subnet calculator follows when it splits an address into network and host portions.
This subnet calculator accepts any IPv4 address with a /0 to /32 prefix, validates the input, and renders all seven derived fields as copyable cards. Network engineers, cloud architects, and DevOps teams use a subnet calculator to size a VPC, to divide a private range into smaller subnets across availability zones, to verify that a firewall rule covers the right hosts, and to answer “is this IP inside that block” questions on the fly.
Why use a subnet calculator?
- Avoid off-by-one host counts. A
/24has 256 addresses but only 254 usable hosts because the network and broadcast addresses are reserved. The calculator does that math without you re-counting on paper. - Validate cloud subnet plans before provisioning. AWS, GCP, and Azure all reject overlapping ranges. Run the calculator on each proposed CIDR before terraforming the network.
- Convert between CIDR and dotted-decimal masks fast. Some legacy switches still expect
255.255.255.0while modern routers want/24. The tool shows both at once. - Verify firewall rule coverage. Paste the rule’s CIDR to see exactly which host range it permits, useful when auditing security groups or VPN access lists.
- Plan VLSM splits without a spreadsheet. Calculate the parent, then re-run the tool on each child range to confirm the subnetting is contiguous and exhaustive.
How to use the Subnet Calculator
- Type or paste an address in CIDR form into the CIDR Notation input, for example
192.168.1.0/24or10.0.0.0/16. - The tool validates the address and prefix as you type, then renders seven result cards.
- Read off the Network, Broadcast, Subnet Mask, First Host, Last Host, Total Hosts, and CIDR values.
- Click the copy icon on any card to drop the value into a ticket, a Terraform variable, or a router config.
- Change the prefix length to split or merge ranges and watch every field recalculate.
CIDR notation
Classless Inter-Domain Routing notation, defined in RFC 4632, writes an IPv4 block as address/prefix-length. The prefix length counts the number of leading 1 bits in the subnet mask, which separates the network portion of the address from the host portion.
192.168.1.0/24
└── 24 network bits, 8 host bits
└── mask 11111111.11111111.11111111.00000000
└── mask 255.255.255.0A /24 covers 256 addresses (2^8), a /16 covers 65 536, and a /32 is a single host. Smaller numbers cover larger blocks. The relationship between prefix length, mask, and host count is fixed by the math, which is why the calculator can compute every field from the prefix alone.
Subnet math example
Take 10.20.30.64/27 and walk it through the steps the calculator runs.
prefix = 27 → mask 255.255.255.224
host bits = 32 - 27 = 5
block size = 2^5 = 32 addresses
network = address AND mask = 10.20.30.64
broadcast = network OR (NOT mask) = 10.20.30.95
first host = network + 1 = 10.20.30.65
last host = broadcast - 1 = 10.20.30.94
usable = block size - 2 = 30 hostsThe mask 255.255.255.224 is 11111111.11111111.11111111.11100000 in binary. The bitwise AND of the address and the mask zeroes the host bits, giving the network address. The bitwise OR with the inverted mask sets every host bit to 1, giving the broadcast.
IPv4 address class reference
The original 1981 classful scheme is obsolete since CIDR landed in 1993, but the class boundaries still show up in default route configurations and in tooling output. The calculator accepts addresses from any class.
| Class | Range | Default mask | Default prefix | Typical use |
|---|---|---|---|---|
| A | 1.0.0.0 – 126.255.255.255 | 255.0.0.0 | /8 | Large private (10.0.0.0/8) |
| B | 128.0.0.0 – 191.255.255.255 | 255.255.0.0 | /16 | Medium private (172.16.0.0/12) |
| C | 192.0.0.0 – 223.255.255.255 | 255.255.255.0 | /24 | Small private (192.168.0.0/16) |
| D | 224.0.0.0 – 239.255.255.255 | n/a | n/a | Multicast |
| E | 240.0.0.0 – 254.255.255.255 | n/a | n/a | Reserved |
Class A through C also defined the legacy classful host counts: 16 777 216 for A, 65 536 for B, and 256 for C. CIDR lets you pick any prefix from /0 to /32, which is why a /27 like the example above can carve a Class A block into 30-host chunks for switch VLANs.
Common use cases
- Cloud network architects sizing VPCs. Pick a
/16for the VPC, split it into/20subnets per availability zone, and reserve/24s for workload tiers. The calculator confirms each split is contiguous. - Network engineers auditing firewall rules. Paste the rule’s CIDR to see the exact host range and spot accidental over-permissions.
- SREs planning Kubernetes pod ranges. Verify that the pod CIDR and the service CIDR do not overlap with the node network before installing CNI.
- Sysadmins designing VLAN host plans. Carve a Class C into
/27or/28blocks for printers, phones, and IoT, sized to actual device counts. - Cybersecurity analysts investigating IOC reports. Convert reported CIDRs into host ranges to compare against access logs.
- Educators teaching networking. Show students how
/24versus/25doubles or halves the host count without manual binary math.
Frequently asked questions
What is a subnet calculator used for?
A subnet calculator derives the network address, broadcast address, subnet mask, host range, and host count from an IPv4 CIDR input. Network engineers use it to plan IP allocations, size VPCs, write firewall rules, and verify that a given address falls inside a given block.
What does the slash number in a CIDR mean?
The slash number is the prefix length: the count of leading 1 bits in the subnet mask. /24 means 24 network bits and 8 host bits, which equals a mask of 255.255.255.0 and a block of 256 addresses. Bigger prefix lengths cover smaller blocks.
How many hosts are in a /24?
A /24 covers 256 addresses (2^8), of which 254 are usable hosts. The first address is the network identifier and the last is the broadcast, and both are reserved by IPv4 routing rules.
What is the difference between network and broadcast address?
The network address is the first address in the block, with every host bit set to 0, and identifies the subnet itself. The broadcast address is the last address, with every host bit set to 1, and is used to send a packet to every host in the subnet at once. Neither can be assigned to a host.
Can I use a /31 or /32 subnet?
Yes. /31 is defined by RFC 3021 for point-to-point links and treats both addresses as usable, giving 2 hosts. /32 represents a single host with no network or broadcast, used for loopback interfaces and host routes. The calculator handles both correctly.
What is the difference between IPv4 and IPv6 subnetting?
IPv4 uses 32-bit addresses and the math above. IPv6 uses 128-bit addresses, written in hex groups, with the same CIDR concept but vastly larger blocks. A /64 is the standard IPv6 subnet size and contains 2^64 addresses. This tool calculates IPv4 only.
What is variable-length subnet masking (VLSM)?
VLSM is the practice of using different prefix lengths inside the same parent block, so you can allocate big subnets where you need many hosts and small subnets where you only need a few. Run the calculator on each child range to verify the splits are contiguous and do not overlap.
Why do some VPC subnets reserve five addresses instead of two?
AWS reserves the network address, the broadcast equivalent, the VPC router (.1), a DNS address (.2), and a future-use address (.3) in every subnet. A /24 therefore has 251 usable hosts in AWS rather than 254. Other clouds reserve different counts; the calculator shows the IPv4-standard count.
How do I know if two CIDRs overlap?
Two blocks overlap when one is contained inside the other, or when they share any host range. The simplest check is to verify that the network address of each block is not inside the other. Cloud consoles reject overlapping subnets, but it is faster to confirm in the calculator before applying.
Related tools
- HAR Viewer: Open and inspect HTTP Archive files captured from DevTools.
- User-Agent Parser: Decode any user agent string into browser, OS, and engine.
- Browser Info: Show your current browser, OS, language, and hardware capabilities.
- Local IP: Detect your local network IP via WebRTC.
Related tools
HAR Viewer
Drop a .har file and get a network timeline. Filter by status, method, or slow requests.
Open toolURL Parser
Decompose a URL into components and edit query params interactively.
Open toolUnix Timestamp Converter
Convert Unix timestamps to readable dates and back. Supports seconds and milliseconds.
Open toolShotMark captures what you do here, in one click.
The traces, payloads, and tests you run by hand? ShotMark grabs the whole bug and hands it to your AI agent.