Skip to content

IPv4 Subnet Calculator

Free IPv4 subnet calculator: enter 192.168.1.130/26 for the network address, broadcast, usable host range, netmask and wildcard, plus paste-ready Cisco and Linux config.

No Tracking Runs in Browser Free
Everything is computed locally in your browser — the addresses you type never leave this device.
/26
Common blocks
Subnet details
CIDR notation
Network address
Broadcast address
Usable host range
Usable hosts
Total addresses
Subnet mask
Wildcard mask
Binary view — where the mask cuts
Network address
Subnet mask
Broadcast address
Network bits Host bits
Network as integer
Network as hex
Reverse DNS (PTR)
Ready-to-paste configuration
Cisco IOS interface
Cisco ACL (wildcard)
OSPF network statement
Cisco ASA (netmask)
Huawei / H3C
Linux iproute2

Cisco IOS ACLs and OSPF take the wildcard mask; the ASA takes the subnet mask instead. Mixing the two is the most common copy-paste failure in this area.

Divide this block into equal subnets
# Subnet Usable range Broadcast Hosts
CIDR to subnet mask reference table
Prefix Subnet mask Wildcard mask Total addresses Usable hosts
/8 255.0.0.0 0.255.255.255 16,777,216 16,777,214
/9 255.128.0.0 0.127.255.255 8,388,608 8,388,606
/10 255.192.0.0 0.63.255.255 4,194,304 4,194,302
/11 255.224.0.0 0.31.255.255 2,097,152 2,097,150
/12 255.240.0.0 0.15.255.255 1,048,576 1,048,574
/13 255.248.0.0 0.7.255.255 524,288 524,286
/14 255.252.0.0 0.3.255.255 262,144 262,142
/15 255.254.0.0 0.1.255.255 131,072 131,070
/16 255.255.0.0 0.0.255.255 65,536 65,534
/17 255.255.128.0 0.0.127.255 32,768 32,766
/18 255.255.192.0 0.0.63.255 16,384 16,382
/19 255.255.224.0 0.0.31.255 8,192 8,190
/20 255.255.240.0 0.0.15.255 4,096 4,094
/21 255.255.248.0 0.0.7.255 2,048 2,046
/22 255.255.252.0 0.0.3.255 1,024 1,022
/23 255.255.254.0 0.0.1.255 512 510
/24 255.255.255.0 0.0.0.255 256 254
/25 255.255.255.128 0.0.0.127 128 126
/26 255.255.255.192 0.0.0.63 64 62
/27 255.255.255.224 0.0.0.31 32 30
/28 255.255.255.240 0.0.0.15 16 14
/29 255.255.255.248 0.0.0.7 8 6
/30 255.255.255.252 0.0.0.3 4 2
/31 255.255.255.254 0.0.0.1 2 2
/32 255.255.255.255 0.0.0.0 1 1

Usable-host counts follow RFC 3021 for /31 (two usable addresses on a point-to-point link) and treat /32 as a single host route.

Reviewed against RFC 950, RFC 1918, RFC 3021, RFC 3927, RFC 5737 and RFC 6598; every example value produced by the tool's unit-tested subnet engine — Go-Tools Engineering Team · Aug 15, 2026

Written and reviewed by engineers who build network tooling, with every address, mask and host count in these examples generated by the calculator's own tested engine.

What Is a Subnet Mask?

A subnet mask splits a 32-bit IPv4 address into two parts: a network portion that every host on the segment shares, and a host portion that identifies the individual machine. The mask is itself 32 bits — a run of 1s marking the network bits followed by 0s marking the host bits — which is why 255.255.255.0 and /24 describe exactly the same thing. CIDR notation just counts the 1 bits instead of spelling them out in decimal.

Everything else follows from that split. Zero out the host bits and you have the network address; set them all to 1 and you have the directed broadcast address; the addresses between the two are what you can assign to hosts. That is where the familiar 2^n − 2 formula comes from, and also why a /26 yields 62 usable hosts rather than 64. When a machine decides whether a destination is local or needs a router, it applies its own mask to both addresses and compares the results — which is precisely the membership test this calculator performs.

Two prefixes break the pattern on purpose. A /31 has only two addresses, leaving no room for a separate network and broadcast; RFC 3021 therefore makes both usable on point-to-point links, and every current router platform honours that. A /32 is a single host route, used for loopback interfaces, static routes, anycast addresses and single-address firewall rules. Applying 2^n − 2 blindly to either one yields 0 usable hosts — an answer no router platform agrees with. The /31 exception carries its own condition: it works only on genuinely point-to-point interfaces, so a shared LAN segment still needs /30 or shorter.

The address you type also carries meaning beyond its mask. 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 are private (RFC 1918) and never routed on the public internet; 100.64.0.0/10 is carrier-grade NAT space; 169.254.0.0/16 appears when DHCP fails; 224.0.0.0/4 is multicast. Historical classes A through E still surface in documentation and certification exams, but classful routing has been obsolete since CIDR arrived in 1993 — the mask, not the first octet, decides where a network ends. To inspect the same address in binary or hexadecimal by hand, the number base converter does the arithmetic.

// Subnetting is integer arithmetic on a 32-bit value.
const toInt = (ip) => ip.split('.').reduce((acc, o) => acc * 256 + Number(o), 0);
const toIp  = (n)  => [24, 16, 8, 0].map((s) => (n >>> s) & 255).join('.');

function subnet(ip, prefix) {
  const mask      = prefix === 0 ? 0 : (0xFFFFFFFF << (32 - prefix)) >>> 0;
  const network   = (toInt(ip) & mask) >>> 0;
  const broadcast = (network | (~mask >>> 0)) >>> 0;
  // RFC 3021: a /31 has two usable addresses; a /32 has one.
  const usable    = prefix >= 31 ? 2 ** (32 - prefix) : 2 ** (32 - prefix) - 2;
  return { network: toIp(network), broadcast: toIp(broadcast), usable };
}

subnet('192.168.1.130', 26);
// { network: '192.168.1.128', broadcast: '192.168.1.191', usable: 62 }

Key Features

Every field, one screen

Network address, broadcast, first and last usable host, usable and total counts, subnet mask and wildcard mask update as you type — no submit button, no page reload, no waiting.

Correct /31 and /32 handling

A /31 reports two usable addresses per RFC 3021 and a /32 reports one, with an inline note explaining why — and when /31 is not safe to use. Applying 2^n − 2 to these prefixes yields zero, which no router agrees with.

Prefix slider from /0 to /32

Drag the prefix and watch the boundary move one bit at a time while the address stays put — the fastest way to answer 'how big does this block need to be?'

Binary view with the mask boundary coloured

Network bits and host bits are drawn in different colours across the network, mask and broadcast rows, so the cut point is visible rather than implied.

Subnet division table

Split any block into equal child subnets at a longer prefix and read their ranges, broadcast addresses and host counts — the VLAN plan sanity check, without a spreadsheet.

Block identification and reverse DNS

A badge names the block your address belongs to (RFC 1918 private, CGNAT, link-local, documentation, benchmarking, multicast, reserved) alongside its integer, hex and in-addr.arpa forms.

Subnet Calculation Examples

Which subnet does 192.168.1.130/26 belong to? — the classic exam question

192.168.1.130/26
Network:   192.168.1.128
Broadcast: 192.168.1.191
Usable:    192.168.1.129 - 192.168.1.190
Hosts:     62 usable of 64 total
Netmask:   255.255.255.192
Wildcard:  0.0.0.63

You typed a host address, not a network address, and that is the point: a /26 mask has 6 host bits, so blocks step every 64 addresses — 0, 64, 128, 192. The address 192.168.1.130 lands in the third block, which is why the network is 192.168.1.128 and not 192.168.1.0. The broadcast is the top of that block (192.168.1.191), leaving 192.168.1.129 through 192.168.1.190 assignable. This is the single most common subnetting mistake: assuming the network address is whatever you typed with the host part zeroed by eye.

Network address, broadcast and usable hosts of 10.0.0.0/22

10.0.0.0/22
Network:   10.0.0.0
Broadcast: 10.0.3.255
Usable:    10.0.0.1 - 10.0.3.254
Hosts:     1,022 usable of 1,024 total
Netmask:   255.255.252.0
Wildcard:  0.0.3.255

A /22 borrows two bits from the third octet, so the block covers 10.0.0.x through 10.0.3.x — four consecutive /24s in one broadcast domain. The mask 255.255.252.0 is where people slip: 252 is 11111100 in binary, so the third octet increments in steps of 4 (10.0.0.0, 10.0.4.0, 10.0.8.0). The binary view in the tool colours the two borrowed bits, and the division table splits this block back into its four /24s.

A /31 point-to-point link: two usable addresses, not zero

203.0.113.4/31
Addresses: 203.0.113.4 and 203.0.113.5
Usable:    2 (both ends of the link)
Broadcast: none
Netmask:   255.255.255.254
Wildcard:  0.0.0.1

RFC 3021 defines /31 for point-to-point links: because such a link has exactly two endpoints and no shared segment, the network and broadcast addresses are dropped and both addresses are assignable. Applying the generic 2^n − 2 formula here yields 0 usable hosts, which is wrong on any modern router — Cisco IOS, Junos and Linux all support /31 on point-to-point interfaces. Using /31 instead of /30 halves the address waste on router-to-router links. The catch is that it is only valid on genuinely point-to-point interfaces: a multi-access LAN segment needs /30 or shorter, and Windows will not accept a /31 on a NIC. The example uses 203.0.113.0/24 because RFC 5737 reserves it for documentation.

Dividing 192.168.1.0/24 into four /26 subnets

192.168.1.0/24 → /26
192.168.1.0/26     192.168.1.1 - 192.168.1.62     bc 192.168.1.63    62 hosts
192.168.1.64/26    192.168.1.65 - 192.168.1.126    bc 192.168.1.127   62 hosts
192.168.1.128/26   192.168.1.129 - 192.168.1.190   bc 192.168.1.191   62 hosts
192.168.1.192/26   192.168.1.193 - 192.168.1.254   bc 192.168.1.255   62 hosts

Borrowing two bits from a /24 produces four equal subnets of 64 addresses each, 62 of them usable. Note that each child subnet loses its own network and broadcast address, so dividing a /24 into four /26s costs you 254 − 248 = 6 usable addresses in total. The division table prints this layout for any parent block and any longer prefix, which is the fastest way to sanity-check a VLAN plan before it reaches a router.

CIDR to subnet mask table: /24 is 255.255.255.0

/24, /25, /26, /27, /28, /29, /30, /31, /32
/24  255.255.255.0     256 addresses   254 usable
/25  255.255.255.128   128 addresses   126 usable
/26  255.255.255.192    64 addresses    62 usable
/27  255.255.255.224    32 addresses    30 usable
/28  255.255.255.240    16 addresses    14 usable
/29  255.255.255.248     8 addresses     6 usable
/30  255.255.255.252     4 addresses     2 usable
/31  255.255.255.254     2 addresses     2 usable (RFC 3021)
/32  255.255.255.255     1 address       1 usable (host route)

Each extra prefix bit halves the block. The last two rows are the ones worth memorising because they break the 2^n − 2 pattern: a /31 has two usable addresses (point-to-point, no broadcast) and a /32 is a single host route used for loopback interfaces, ACL entries and static routes. The full table from /8 to /32 is rendered under the calculator and is generated by the same engine that powers it.

How to Use the IPv4 Subnet Calculator

  1. 1

    Enter an address or CIDR block

    Type 192.168.1.130/26, paste 10.0.0.0 255.255.252.0, or enter a bare address and set the prefix with the slider. A host address is fine — the tool masks it down to its network for you.

  2. 2

    Move the prefix slider to see the boundary shift

    Drag from /0 to /32 and watch the host count, mask and broadcast address recalculate. The slider keeps your address fixed, so it answers 'what if I resize this block?' in one gesture.

  3. 3

    Read the subnet details

    Network address, broadcast, first and last usable host, usable and total counts, subnet mask and wildcard mask — plus a badge naming the block (private, CGNAT, link-local, documentation, multicast) and its historical class.

  4. 4

    Check the binary view and address forms

    Network bits and host bits are coloured separately so the mask boundary is visible bit by bit. The same panel gives the network as an integer, as hexadecimal, and as a reverse-DNS in-addr.arpa name.

  5. 5

    Test membership and divide the block

    Paste any address to confirm whether it falls inside the current subnet, then pick a longer prefix to split the block into equal child subnets with their ranges, broadcasts and host counts.

Common Subnetting Mistakes

Assuming the address you typed is the network address

A host address masked with a /26 rarely sits at the start of its block. The network is whatever remains after zeroing the host bits, which is why 192.168.1.130/26 belongs to 192.168.1.128, not 192.168.1.0.

✗ Wrong
192.168.1.130/26 -> network 192.168.1.0, broadcast 192.168.1.255
✓ Correct
192.168.1.130/26 -> network 192.168.1.128, broadcast 192.168.1.191

Applying 2^n - 2 to a /31

The minus-two rule assumes a network and a broadcast address exist. On a /31 point-to-point link they do not, and RFC 3021 makes both addresses assignable. Reporting zero usable hosts here contradicts every current router platform.

✗ Wrong
203.0.113.4/31 -> 0 usable hosts
✓ Correct
203.0.113.4/31 -> 2 usable hosts (203.0.113.4 and 203.0.113.5)

Treating 172.16.0.0/12 as 172.16.x.x only

The private range spans 172.16.0.0 through 172.31.255.255 — sixteen /16s, not one. Addresses in 172.15.x.x and 172.32.x.x are public and belong to somebody else.

✗ Wrong
172.20.5.1 -> assumed public because it is not 172.16.x.x
✓ Correct
172.20.5.1 -> private, inside 172.16.0.0/12 (172.16.0.0 - 172.31.255.255)

Writing a non-contiguous subnet mask

A subnet mask must be a solid run of 1s followed by 0s. Values like 255.0.255.0 are not valid masks, even though ACL wildcards are allowed to have gaps. Devices reject them, and a calculator that accepts them is hiding a typo.

✗ Wrong
10.0.0.0 255.0.255.0
✓ Correct
10.0.0.0 255.255.252.0   (= 10.0.0.0/22)

What You Can Do with the Subnet Calculator

Plan VLANs and address blocks
Divide an allocation into equal subnets, confirm each one is large enough for its host count, and copy the layout straight into your IPAM spreadsheet or design document before it reaches a switch.
Write firewall rules and ACLs
Read the wildcard mask for Cisco ACLs and OSPF network statements, and confirm the exact address range a rule will match — the difference between 0.0.0.63 and 0.0.0.31 is two VLANs' worth of hosts.
Troubleshoot a host that cannot reach the gateway
Paste the host address and the mask it was configured with, then check whether the gateway falls inside the resulting subnet. A mismatched mask is the classic cause of 'it pings some things but not others'.
Number router-to-router links efficiently
Compare /30 against /31 for point-to-point links: the /31 gives both endpoints an address instead of wasting two per link, which adds up quickly across a WAN with hundreds of circuits.
Study for CCNA, Network+ and similar exams
Work a subnetting question by hand, then check the network address, broadcast and host range here. The binary view shows the borrowed bits, which is what the exam is actually testing.

How IPv4 Subnetting Works

The mask is a bit boundary, not a decimal value
A subnet mask is 32 bits: a contiguous run of 1s for the network, then 0s for hosts. Only 33 masks are valid (/0 through /32), which is why 255.255.255.192 is legal and 255.0.255.0 is not — the latter has a hole in it. This calculator rejects non-contiguous masks rather than guessing what you meant.
Block size and the fourth-octet shortcut
Subnets of the same size sit on multiples of their block size, and the block size is 256 minus the relevant mask octet. A /26 ends in 192, so blocks start at 0, 64, 128 and 192; a /28 ends in 240, so they step every 16. This is the arithmetic behind 'which subnet does 192.168.1.130 belong to?' — it is the third /26 block, hence 192.168.1.128.
Reserved addresses and the two exceptions
The all-zeros host address identifies the network and the all-ones host address is the directed broadcast, so ordinary subnets lose two addresses. RFC 3021 waives both for /31 point-to-point links (two usable addresses), and a /32 is a single host route (one usable address). The reference table under the calculator follows those rules, so its /31 row reads 2 rather than 0.
Wildcard masks and where they are required
The wildcard mask is the bitwise inverse of the subnet mask — 255.255.255.192 inverts to 0.0.0.63. Cisco ACLs, OSPF network statements and EIGRP take wildcards instead of masks. Unlike subnet masks, ACL wildcards may be non-contiguous, which is how a single rule can match every odd-numbered address in a range.
Classes are history, blocks are current
Class A/B/C/D/E divides the address space by first octet (0–127, 128–191, 192–223, 224–239, 240–255) and is still taught and examined, but CIDR replaced classful routing in 1993 — the mask decides where a network ends, not the leading bits. What does still matter is which reserved block an address falls into: RFC 1918 private, RFC 6598 CGNAT, RFC 3927 link-local, RFC 5737 documentation, RFC 2544 benchmarking, multicast and the 240.0.0.0/4 reserved range.

IP Addressing Best Practices

Size the subnet for growth, but not by a factor of ten
A /24 for eight devices wastes 246 addresses and enlarges the broadcast domain for no benefit. Pick the smallest prefix that leaves comfortable headroom — the calculator's host count makes the trade-off explicit before you commit.
Use /31 on point-to-point links
On router-to-router circuits a /31 gives both ends an address instead of burning four addresses for two endpoints. Reserve /30 for equipment that genuinely predates RFC 3021 support, and never put a /31 on a multi-access segment.
Allocate on a bit boundary, not on round decimal numbers
Address plans that start blocks at 10.0.10.0 or 10.0.100.0 look tidy in decimal but cannot be summarised into a single route. Align allocations to powers of two so a whole region collapses into one prefix in the routing table.
Keep documentation examples in the reserved ranges
RFC 5737 reserves 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 precisely so that examples cannot collide with a real network. Using a random public address in a runbook eventually points someone at a live host.
Verify the mask on both ends before blaming routing
When a host reaches some destinations but not others, compare its mask against the gateway's. A /24 configured where the segment is a /23 makes half the network look remote — paste both addresses into the membership check and the mismatch shows up immediately.

Subnet Calculator FAQ

How do I calculate a subnet mask from a CIDR prefix?
The prefix is simply the count of leading 1 bits in the 32-bit mask. A /26 means 26 ones followed by 6 zeros: 11111111.11111111.11111111.11000000, which reads back as 255.255.255.192. The trailing zeros are the host bits, so the block holds 2^6 = 64 addresses. Working the other way, count the 1 bits in the mask: 255.255.252.0 is 11111111.11111111.11111100.00000000 = 22 ones, so it is a /22. The binary view in this calculator shows the boundary directly, with network bits and host bits in different colours.
What prefix length is 255.255.255.0?
It is a /24. 255 in binary is 11111111, so three octets of 255 give 24 leading 1 bits, and the last 8 bits are host bits — 255.255.255.0 = /24, with 256 addresses and 254 usable hosts. By the same reasoning 255.255.255.192 is a /26 (64 addresses, 62 usable), 255.255.252.0 is a /22 (1,024 addresses, 1,022 usable), and 255.255.255.128 is a /25 (128 addresses, 126 usable). Paste a dotted-decimal mask straight into the input to read its prefix back, or use the reference table below the calculator, which lists the mask, wildcard and host count for every prefix from /8 to /32.
How do I convert an IP address to a decimal integer or hexadecimal?
Treat the four octets as one 32-bit integer: 192.168.1.128 = 192×256³ + 168×256² + 1×256 + 128 = 3232235904, which is 0xC0A80180 in hexadecimal. This form turns up when a database stores addresses in an integer column (MySQL's INET_ATON / INET_NTOA), when filtering logs by range, and in any bitwise membership test. The binary panel of this calculator prints the network address as a decimal integer, as hexadecimal, and as a reverse-DNS in-addr.arpa name. To convert between bases by hand, use the number base converter.
How do I apply the result to a Cisco or Huawei device?
The ready-to-paste configuration panel generates six forms for the current block. For 192.168.1.130/26 those are: Cisco IOS interface ip address 192.168.1.129 255.255.255.192; Cisco ACL with the wildcard access-list 10 permit 192.168.1.128 0.0.0.63; OSPF network 192.168.1.128 0.0.0.63 area 0; Cisco ASA, which takes the subnet mask instead, access-list OUT permit ip 192.168.1.128 255.255.255.192 any; Huawei/H3C ip address 192.168.1.129 26; and Linux iproute2 ip addr add 192.168.1.129/26 dev eth0. The trap is that IOS ACLs and OSPF take the wildcard while the ASA takes the subnet mask — swapping them raises no error but matches a completely different range.
Why is the usable host count two less than the total?
Every ordinary IPv4 subnet reserves its first address as the network identifier and its last as the directed broadcast address, so a /24 with 256 addresses offers 254 to hosts. Two prefixes are exceptions: a /31 has no room for those reserved addresses, and RFC 3021 makes both of its addresses usable on point-to-point links; a /32 is a single host route with one usable address. This calculator applies those exceptions — the generic 2^n − 2 formula would report 0 usable addresses for a /31, which no modern router agrees with.
What is a wildcard mask and how is it different from a subnet mask?
A wildcard mask is the bitwise inverse of the subnet mask: where the subnet mask has 1s, the wildcard has 0s. For a /26, the mask is 255.255.255.192 and the wildcard is 0.0.0.63. Cisco access control lists and OSPF network statements take wildcards rather than masks, so access-list 10 permit 192.168.1.128 0.0.0.63 matches the same block as 192.168.1.128/26. Huawei and H3C documentation calls it a wildcard mask too, while inverse mask is common shorthand among engineers; both names refer to the same value here. Note that ACL wildcards may legally have non-contiguous bits (matching odd or even addresses, for instance) while subnet masks may not.
How many hosts fit in a /24, /25 or /26?
A /24 (255.255.255.0) has 256 addresses and 254 usable hosts. A /25 (255.255.255.128) has 128 addresses and 126 usable. A /26 (255.255.255.192) has 64 addresses and 62 usable. Each additional prefix bit halves both numbers. A useful shortcut when subnetting the fourth octet: the block size is 256 minus the last mask octet, so a mask ending in 192 steps every 64 addresses and a mask ending in 240 steps every 16. The full reference table under the calculator covers /8 through /32.
Which IP ranges are private and which are public?
RFC 1918 reserves three private ranges: 10.0.0.0/8 (16,777,214 usable), 172.16.0.0/12 (1,048,574 usable) and 192.168.0.0/16 (65,534 usable). Note that the 172 range covers 172.16.0.0 to 172.31.255.255 only — 172.15.x.x and 172.32.x.x are public, a boundary that is easy to get wrong. Beyond those, 100.64.0.0/10 is carrier-grade NAT space (RFC 6598), 169.254.0.0/16 is link-local autoconfiguration (RFC 3927), and 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 are reserved for documentation (RFC 5737). This calculator labels whichever block your address falls into.
Can I use a /31 or /32 on a real network?
Yes. A /31 is the standard way to number router-to-router links: RFC 3021 removes the network and broadcast addresses for point-to-point interfaces so both addresses go to the two endpoints, halving the waste compared with the traditional /30. It is supported on Cisco IOS, Junos, Arista EOS and Linux, but it is only valid on genuinely point-to-point interfaces — do not put a /31 on a multi-access LAN segment. A /32 is a host route: loopback interfaces, single-address ACL entries, static routes and anycast addresses all use it.
Are the addresses I type sent to a server?
No. Every calculation runs locally in your browser with plain integer arithmetic — no network request, no third-party library, no logging. You can open your browser's developer tools and watch the network panel stay silent while you type, or disconnect from the internet entirely and keep calculating. The Copy link button encodes the current block into the URL fragment, which browsers never transmit to a server.

Related Tools

View all tools →