IP subnet calculator
SubnetKit is an IP subnet calculator: enter an IPv4 or IPv6 address with a prefix or mask to get the network, broadcast, usable host range, host count, subnet mask, wildcard, binary and its RFC block. All in your browser.
CIDR (192.0.2.0/24), address and mask (192.0.2.0 255.255.255.0), a bare address (read as /24) or IPv6 (2001:db8::/48). Arrow Up and Arrow Down move the prefix, and so does dragging the marker on the bit bar.
Usable in AWS / Azure: 251, GCP: 252Plan it with AWS reserved addresses
11000000.00000000.00000010.0000000011111111.11111111.11111111.00000000Show the working192.0.2.0/24, step by step
Write the address in binary. Each of the four octets is 8 bits.
11000000.00000000.00000010.00000000192.0.2.0Write the mask. /24 is 24 ones followed by 8 zeros.
11111111.11111111.11111111.00000000255.255.255.0AND the address with the mask. A bit stays 1 only where both have a 1, so every host bit drops to 0. That is the network address.
11000000.00000000.00000010.00000000192.0.2.0AND11111111.11111111.11111111.00000000255.255.255.0=11000000.00000000.00000010.00000000network 192.0.2.0Set all 8 host bits to 1. OR the network with the host bits. That is the broadcast address.
11000000.00000000.00000010.00000000192.0.2.0OR00000000.00000000.00000000.111111110.0.0.255=11000000.00000000.00000010.11111111broadcast 192.0.2.255Count the hosts. 8 host bits give 2^8 = 256 addresses. The network and broadcast addresses are not hosts, so take 2 away.
2^8 minus 2 = 254usable, 192.0.2.1 to 192.0.2.254Check the special-purpose registry. 192.0.2.0/24 sits inside 192.0.2.0/24, Documentation (TEST-NET-1, RFC 5737).
Every number above comes from the same code as the calculator. How this is computed
Networking calculators
All tools- 01
CIDR calculator
Expand a CIDR block into its range, or turn a range into CIDR blocks. - 02
Subnet mask calculator
Convert between prefix length and subnet mask, both directions. - 03
Wildcard mask calculator
Turn a subnet mask into the wildcard mask used in Cisco ACLs. - 04
Supernet calculator
Summarize multiple networks into one aggregate CIDR route. - 05
IPv6 subnet calculator
Expand, compress, and subnet any IPv6 prefix. - 06
IP converter
Convert IPs between decimal, integer, binary, hex and octal, in bulk. - 07
MAC address formatter
Reformat a MAC address between colon, dash, dotted and bare forms. - 08
Random IP generator
Generate random valid IPv4 addresses, public or private, for testing.
Reference
CIDR cheat sheet- /cidr
CIDR cheat sheet
Every prefix from /0 to /32 with its mask, wildcard, and host count.
- /port
Port numbers
Common TCP and UDP ports, what they do, and their security notes.
- /hosts
Subnet by host count
Need room for N hosts? Find the smallest block that fits.
- /guide/what-is-a-subnet
What is a subnet?
A plain-English guide to subnetting, masks, and CIDR.
- /api
Free JSON API
Keyless CIDR and port lookups you can build on. No rate limits.
Frequently asked questions
What is the usable host range?
It is every address in the block except the first, the network address, and the last, the broadcast address. For 192.0.2.0/24 that is 192.0.2.1 to 192.0.2.254, which is 254 usable hosts; a /30 has 2. A /31 point-to-point link uses both of its addresses (RFC 3021), so it has 2, and a /32 is a single host, so it has 1.
How many hosts are in a /24, /26, /27, /28, /29 and /30?
Usable hosts are the block size minus the network and broadcast addresses: a /24 (255.255.255.0) has 254, a /26 (255.255.255.192) has 62, a /27 (255.255.255.224) has 30, a /28 (255.255.255.240) has 14, a /29 (255.255.255.248) has 6 and a /30 (255.255.255.252) has 2. The CIDR cheat sheet lists all 33 prefixes from /0 to /32.
What does a subnet calculator do?
It takes an IP address and a prefix or mask, then works out the network address, broadcast address, usable host range, host count, subnet mask, wildcard mask and binary form. SubnetKit does all of this instantly in your browser, for IPv4 and for IPv6.
How do I calculate a subnet?
Enter the IP with its prefix, such as 192.0.2.0/24, or an IP with a dotted mask, such as 192.0.2.0 255.255.255.0. The calculator reads off the network, first and last usable host, broadcast and total addresses as you type. Arrow Up and Arrow Down in the field, or the minus and plus buttons next to it, change the prefix by one.
Does it work with IPv6?
Yes. Type an IPv6 network such as 2001:db8::/48 into the same field. You get the network, the first and last address, the prefix, the number of addresses and the number of /64 subnets, which is 65,536 for a /48. IPv6 has no broadcast address, so every address in the block is usable.
Can it split a network into smaller subnets?
Yes. The Plan tab splits a block into equal subnets or sizes each one by host count (VLSM), and exports the plan as CSV, Markdown, JSON or Terraform. The Batch tab checks a whole list of ranges at once for overlaps, gaps and the smallest set of CIDR blocks that covers them.
Is SubnetKit free?
Yes. Every calculator and reference page is free with no sign up and no limits. Nothing you type is uploaded, because the maths runs entirely on your device.
Why SubnetKit
Most subnet calculators reload the page when you submit, bury the result under ads, or make you pick IPv4 or IPv6 first. SubnetKit takes either in one field, shows everything at once and recomputes on every keystroke. It is built for people who reach for a subnet calculator ten times a day and want it to get out of the way.
Because all the maths is plain JavaScript running in your browser, nothing you type is ever sent to a server. That also makes it fast: there is no round trip, so results appear the instant you type. Pair it with the CIDR reference for the full prefix table, or the IPv6 subnet calculator for the expanded form and more IPv6 detail.
Do this from the terminal
The same reference data is a keyless JSON endpoint, and there are good local tools that need no network at all.
curl -s https://subnetkit.dev/api/cidr/24.json | jq # or locally, with no network at all: ipcalc 192.0.2.0/24 sipcalc 192.0.2.0/24
ipcalc ships in most Linux distributions and sipcalc handles IPv4 and IPv6. Both give the same network, broadcast and host range this page does.
The SubnetKit API is the one to reach for in a build step or a script. It has no key and no rate limit, and the full schema is in the OpenAPI document.