N
NJHTools

Subnet Calculator

This free subnet and CIDR calculator takes an IP address with a prefix or netmask and instantly shows the network address, broadcast, usable host range, host count, wildcard mask and binary breakdown. It handles IPv4 and IPv6, splits IPv4 networks into equal subnets and converts IPv4 ranges to CIDR blocks, all calculated in your browser.

Tip: you can type the whole thing in the address box, e.g. 10.0.0.0/8 or 172.16.5.4 255.255.240.0.

192.168.1.0/24

private
Network address
192.168.1.0
Broadcast address
192.168.1.255
First usable host
192.168.1.1
Last usable host
192.168.1.254
Usable host range
192.168.1.1 – 192.168.1.254
Total addresses
256
Usable hosts
254
Netmask
255.255.255.0
Wildcard (Cisco ACL)
0.0.0.255
CIDR notation
192.168.1.0/24
Class (historic)
C
Address type
Private network (RFC 1918)

Binary view

Address11000000.10101000.00000001.00001010
Netmask11111111.11111111.11111111.00000000
Wildcard00000000.00000000.00000000.11111111
Network11000000.10101000.00000001.00000000
Broadcast11000000.10101000.00000001.11111111

Teal bits are the network part (/24); the rest identify hosts.

Split into subnets

4 × /26 — 62 usable hosts each

#SubnetUsable rangeBroadcast
1192.168.1.0/26192.168.1.1 – 192.168.1.62192.168.1.63
2192.168.1.64/26192.168.1.65 – 192.168.1.126192.168.1.127
3192.168.1.128/26192.168.1.129 – 192.168.1.190192.168.1.191
4192.168.1.192/26192.168.1.193 – 192.168.1.254192.168.1.255

How to calculate a subnet

  1. Enter an address. Type an IPv4 address such as 192.168.1.10, or a full CIDR like 10.0.0.0/8 or 172.16.5.4 255.255.240.0. Switch to the IPv6 tab for addresses like 2001:db8::1.
  2. Set the prefix or netmask. Enter a prefix length (/24) or a dotted netmask (255.255.255.0). For IPv6, enter a prefix from /0 to /128, typically /48, /56 or /64.
  3. Read the results. The network address, broadcast, first and last usable host, host count, netmask, wildcard mask, class and address type update as you type, with a colour-coded binary view.
  4. Split or convert. On the IPv4 tab, enter a number of subnets to split the network into equal blocks, or use the Range → CIDR tab to turn a start and end IPv4 address into the smallest list of CIDR blocks. Copy any value with one click.

CIDR cheat sheet: /8 to /32

Every prefix length with its netmask, wildcard mask and size. Usable hosts are the total minus the network and broadcast addresses, except /31 (point-to-point, RFC 3021) and /32 (a single host).

CIDRNetmaskWildcardAddressesUsable hosts
/8255.0.0.00.255.255.25516,777,21616,777,214
/9255.128.0.00.127.255.2558,388,6088,388,606
/10255.192.0.00.63.255.2554,194,3044,194,302
/11255.224.0.00.31.255.2552,097,1522,097,150
/12255.240.0.00.15.255.2551,048,5761,048,574
/13255.248.0.00.7.255.255524,288524,286
/14255.252.0.00.3.255.255262,144262,142
/15255.254.0.00.1.255.255131,072131,070
/16255.255.0.00.0.255.25565,53665,534
/17255.255.128.00.0.127.25532,76832,766
/18255.255.192.00.0.63.25516,38416,382
/19255.255.224.00.0.31.2558,1928,190
/20255.255.240.00.0.15.2554,0964,094
/21255.255.248.00.0.7.2552,0482,046
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342
/31255.255.255.2540.0.0.122
/32255.255.255.2550.0.0.011

Subnetting basics: network, broadcast and hosts

An IPv4 address is 32 bits. The prefix length says how many of those bits, counted from the left, identify the network; the remaining bits identify a host on it. In 192.168.1.130/26 the first 26 bits are the network, which leaves 6 host bits and 26 = 64 addresses.

  • Network address — all host bits 0 (192.168.1.128). It names the subnet and is not assigned to a device.
  • Broadcast address — all host bits 1 (192.168.1.191). Packets sent here reach every host on the subnet.
  • Usable hosts — everything in between (.129–.190, 62 hosts). The gateway is usually the first or last one.

Splitting a network borrows host bits: each extra bit doubles the number of subnets and halves their size. A /24 split into 4 gives four /26 networks; asking for 3 also gives /26, because subnets only come in powers of two.

IPv6 prefixes in practice

IPv6 addresses are 128 bits, written as eight groups of four hex digits. Leading zeros in a group can be dropped and one run of zero groups can be replaced by ::, so 2001:0db8:0000:0000:0000:0000:0000:0001 becomes 2001:db8::1. The calculator shows both forms, using the RFC 5952 canonical compression.

Common sizes: a /64 is one LAN segment; a /56 (256 × /64) is a typical home allocation; a /48 (65,536 × /64) is a typical business site; and point-to-point links often use a /127. Address types are detected automatically: global unicast (2000::/3), unique local (fc00::/7), link-local (fe80::/10), multicast (ff00::/8), documentation (2001:db8::/32) and more.

Related tools

Frequently Asked Questions

How do I calculate a subnet from an IP address and CIDR?↓

Convert the prefix to a netmask (a /26 is 26 one-bits: 255.255.255.192), then AND it with the IP address to get the network address. Setting all host bits to 1 gives the broadcast address, and the usable hosts are everything in between. The calculator does this instantly: enter 192.168.1.130/26 and you get network 192.168.1.128, broadcast 192.168.1.191 and hosts .129 to .190.

How many usable hosts are in a /24, /27 or /30?↓

A subnet has 2^(32 − prefix) addresses, minus 2 for the network and broadcast addresses. So a /24 has 256 addresses and 254 usable hosts, a /27 has 32 and 30 usable, and a /30 has 4 and 2 usable. A /31 is a special case with 2 usable addresses for point-to-point links (RFC 3021), and a /32 is a single host.

What is a wildcard mask?↓

A wildcard mask is the inverse of the netmask: every 0 becomes 1 and every 1 becomes 0. For 255.255.255.0 the wildcard is 0.0.0.255. Cisco access lists and OSPF network statements use wildcard masks to say which bits of an address may vary.

Which IP addresses are private?↓

The RFC 1918 private ranges are 10.0.0.0/8, 172.16.0.0/12 (172.16.0.0 to 172.31.255.255) and 192.168.0.0/16. 100.64.0.0/10 is shared address space for carrier-grade NAT. In IPv6, unique local addresses (fc00::/7, in practice fd00::/8) play the role of private addresses. The calculator labels each address as private, public, reserved or special.

Why is a /64 the standard IPv6 subnet size?↓

IPv6 stateless address autoconfiguration (SLAAC) builds a device's address from a 64-bit interface identifier, so LAN subnets are /64. ISPs typically delegate a /48 or /56 to a site: a /48 contains 65,536 /64 subnets and a /56 contains 256. The calculator shows the /64 count for any prefix.

How do I convert an IP range to CIDR?↓

Open the Range → CIDR tab and enter the first and last IPv4 address. The tool returns the smallest set of CIDR blocks that covers exactly that range — for example 10.0.0.1 to 10.0.0.6 becomes 10.0.0.1/32, 10.0.0.2/31, 10.0.0.4/31 and 10.0.0.6/32 — ready to paste into a firewall rule.

Last updated: