IP Subnet Calculator with Binary Steps, VLSM and IPv6

Type an address like 192.168.10.37/26 to get the network, broadcast, host range and masks, with the binary working shown. Split or summarize networks, plan VLSM, work with IPv6 prefixes, or practise CCNA-style questions.

Try:

Runs entirely in your browser. Checked against Python's ipaddress module on more than 27,000 random cases.

On this page

  1. How to use the subnet calculator
  2. How subnetting works in binary
  3. Three worked examples
  4. IPv6 and the /64 rule
  5. Common subnetting mistakes

How to use the subnet calculator

  1. IPv4: type an address with its prefix, such as 192.168.10.37/26. The answer updates as you type.
  2. Open Show the binary working under the result. It lines up the address, the mask, the AND result and the broadcast bit by bit, with network bits in green and host bits in orange.
  3. Split and summarize: split a network by number of subnets, new prefix or hosts per subnet, or paste a list of routes to summarize.
  4. VLSM: enter a base network and one row per subnet with the hosts it needs. The planner places the largest block first.
  5. IPv6: type an address with its prefix length, such as 2001:db8:abcd:12::1/64, and choose a longer prefix to split it.
  6. Practice: press New question, fill in the five boxes and press Check my answers.
You typeRead as
192.168.10.37/26Prefix length 26
192.168.10.37 255.255.255.192Subnet mask, so /26
192.168.10.37 0.0.0.63Wildcard mask, so /26
192.168.10.37Uses the Prefix menu
2001:db8::1/64IPv6 prefix; with no prefix, /64 is used

Every result has a Copy link button, and links like these open the exact problem:

Add to the page addressOpens
?ip=10.0.0.0/22The IPv4 result for 10.0.0.0/22
?tab=split&net=192.168.0.0/24&by=subnets&n=6A split (by is subnets, prefix or hosts)
?tab=split&nets=10.1.0.0/24,10.1.1.0/24A route summary
?tab=vlsm&net=192.168.1.0/24&hosts=50,20,10A VLSM plan (add &names=Sales,HR,Lab)
?ip=2001:db8::/48&split=64An IPv6 prefix split into /64s
?tab=practice&q=172.16.45.200/21One practice question

How subnetting works in binary

An IPv4 address is 32 bits, written as four 8-bit numbers called octets. The prefix length /p says how many bits from the left name the network. The other 32 − p bits number the hosts inside it. The subnet mask writes the same thing as an address: p ones, then zeros, so /26 is 255.255.255.192. The wildcard mask flips every bit (0.0.0.63) and is what Cisco ACLs and OSPF network statements use.

The "minus 2" removes the network address and the broadcast address, which no host can use.

PrefixMaskAddressesUsable hosts
/16255.255.0.065,53665,534
/22255.255.252.01,0241,022
/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 (point-to-point)
/32255.255.255.25511 (single host)

The magic-number shortcut

You rarely need all 32 bits. Find the interesting octet, the one where the mask is neither 255 nor 0. The block size is 256 minus that mask octet, and subnets start at multiples of it. The network is the last multiple at or below the address's octet; the broadcast is one less than the next multiple. For the mask 255.255.255.224 the block is 256 − 224 = 32, so subnets start at 0, 32, 64, 96 and so on.

/31 and /32

A /31 has only two addresses. Under RFC 3021 both are usable on a point-to-point link between two routers, because such a link needs no broadcast. A /32 is one address, used for loopbacks and host routes. The calculator reports 2 and 1 usable hosts for them, not the 0 and −1 the formula would give.

Route summarization

To summarize routes, write the networks in binary and count the leading bits they all share. 172.16.4.0/24, 172.16.5.0/24 and 172.16.6.0/24 differ only in the third octet, where 00000100, 00000101 and 00000110 share their first 6 bits. The summary keeps 16 + 6 = 22 bits: 172.16.4.0/22. That route also covers 172.16.7.0/24, which was not listed, so the tool flags 256 extra addresses and gives the exact alternative, 172.16.4.0/23 plus 172.16.6.0/24.

Three worked examples

1. 192.168.10.37/26, bit by bit

A /26 leaves 6 host bits. Line up the address and the mask; the bar marks where the network bits end:

LineDottedBinary
Address192.168.10.3711000000.10101000.00001010.00|100101
Mask /26255.255.255.19211111111.11111111.11111111.11|000000
AND = network192.168.10.011000000.10101000.00001010.00|000000
Host bits 1 = broadcast192.168.10.6311000000.10101000.00001010.00|111111

The hosts run from 192.168.10.1 to 192.168.10.62, so 2^6 − 2 = 62 are usable. The shortcut agrees: the block size is 256 − 192 = 64, and 37 sits in the block 0 to 63.

2. 172.16.45.200/21 with the magic number

This one catches many CCNA students, because the prefix ends in the third octet. The mask is 255.255.248.0, so the third octet is the interesting one and the block size is 256 − 248 = 8. Blocks start at 0, 8, 16, 24, 32, 40, 48 and so on, and 45 falls in the block 40 to 47.

In binary, 45 is 00101101 and 248 is 11111000. Their AND is 00101000, which is 40, the same answer.

3. VLSM for four departments

A branch office gets 192.168.1.0/24 and needs four subnets: Sales with 50 hosts, HR with 20, a lab with 10 and a WAN link with 2. For each, add 2 for the network and broadcast addresses and round up to a power of two: 52 becomes 64 (/26), 22 becomes 32 (/27), 12 becomes 16 (/28) and 4 stays 4 (/30). Then place them largest first:

SubnetHosts neededNetworkUsable rangeBroadcastWasted
Sales50192.168.1.0/26.1 to .62.6312
HR20192.168.1.64/27.65 to .94.9510
Lab10192.168.1.96/28.97 to .110.1114
WAN link2192.168.1.112/30.113 to .114.1150

The plan uses 116 of the 256 addresses. The rest, 192.168.1.116/30, 192.168.1.120/29 and 192.168.1.128/25, stays free for growth: 140 addresses in all.

IPv6 and the /64 rule

An IPv6 address is 128 bits, written as eight groups of four hex digits. RFC 5952 fixes the short form: drop leading zeros in each group, use lower case, and replace the longest run of two or more all-zero groups with ::, taking the first run when two tie. So 2001:0db8:0000:0000:0001:0000:0000:0001 is written 2001:db8::1:0:0:1.

The other rule is the /64. An IPv6 LAN is a /64 because SLAAC, the automatic addressing most devices use, builds the last 64 bits (the interface ID) on its own. One /64 holds 2^64 = 18,446,744,073,709,551,616 addresses, so you never size an IPv6 LAN by host count. You count /64s instead: a /48 site has 2^16 = 65,536 of them, and a /56 has 256. IPv6 has no broadcast address. Prefixes longer than /64 break SLAAC, so keep them for point-to-point links (/127) and loopbacks (/128).

Common subnetting mistakes

Exam tip

Learn the mask octets 128, 192, 224, 240, 248 and 252 with their block sizes 128, 64, 32, 16, 8 and 4. Most subnetting questions then come down to one subtraction from 256. Use the Practice tab until you get all five answers right without the binary.

Embed the Subnet Calculator on your website

Teachers, bloggers and course sites can add this tool to any web page for free. Paste the code below into an HTML or embed block (WordPress, Google Sites, Canvas, Moodle, Blogger, Wix). It loads the same tool you see above, without our menus or ads. Please keep the credit line under the frame. Sizes, a live preview and step-by-step guides for each platform are on the calculator widget page.

Frequently asked questions

How many usable hosts are in a /24?

254. A /24 has 2^8 = 256 addresses, and the network address and the broadcast address cannot be given to hosts, so 256 − 2 = 254 are usable. The same rule gives 62 for a /26 and 2 for a /30.

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

They are bitwise opposites. The subnet mask 255.255.255.0 has 1 bits for the network part, while the wildcard 0.0.0.255 has 1 bits for the part that may vary. Cisco ACLs and OSPF use wildcards. This calculator accepts either one and shows both.

Why does a /31 have two usable addresses?

RFC 3021 allows a /31 on a point-to-point link, where only two devices exist and no broadcast is needed. Both addresses go to the two routers, which uses half the addresses a /30 would. The calculator shows 2 usable hosts for a /31.

How do I work out how many subnets I get?

Each bit you borrow from the host part doubles the subnets: subnets = 2^(new prefix − old prefix). Going from /24 to /27 borrows 3 bits and gives 8 subnets of 32 addresses, with 30 usable hosts each. The Split tab works this out from a count, a prefix or a host requirement.

Are IP address classes still used?

Not for routing. Classes A, B and C gave fixed masks of /8, /16 and /24 until CIDR replaced them in 1993. Exams still ask for the class, so the calculator shows it, marked as historical.

How many /64 subnets are in a /48?

65,536, because 2^(64 − 48) = 2^16. A /56 holds 256 of them and a /60 holds 16. The IPv6 tab shows this count for any prefix and can list the /64s.

The WideMath team

Anuj Paudel, Ashish Pandey and Jhalak Prasad Pandey, Nepal

We build WideMath's free calculators. Every worked example on this page was computed with the tool above and checked against an independent method before it was published. Found a wrong answer? Tell us at [email protected].