Skip to content
Tape and Square

N-01 · Networking

Subnet calculator

Network, broadcast, usable host range and masks for any IPv4 address, and network, range and size for IPv6. Type an address in CIDR form, with a dotted mask, or with the number of hosts you need.

/26

Also accepts 192.168.1.130 255.255.255.192, 192.168.1.0 60 hosts or IPv6 like 2001:db8::/48.

Result

192.168.1.128/26

62 usable hosts

Network
192.168.1.128
First usable
192.168.1.129
Last usable
192.168.1.190
Broadcast
192.168.1.191
Subnet mask
255.255.255.192
Wildcard mask
0.0.0.63
Total addresses
64
PRIVATE

Inside 192.168.0.0/16, a private range (RFC 1918). Not routable on the public internet.

Binary view

Address · 192.168.1.130
11000000.10101000.00000001.10000010
Mask · 255.255.255.192
11111111.11111111.11111111.11000000
Network · 192.168.1.128
11000000.10101000.00000001.10000000

Bold bits are fixed for the network; orange bits number the hosts.

192.168.1.0/24 split into /26

  1. 192.168.1.128/26.129–.190 ◂

How subnetting works

An IPv4 address is 32 bits. The prefix length says how many of those bits, counted from the left, identify the network. The rest identify a device on that network. A /26 fixes 26 bits and leaves 6 for hosts, which gives 26 = 64 addresses.

Formula

Network
address AND mask
Broadcast
network OR wildcard
Wildcard
NOT mask
Usable hosts
2(32 − prefix) − 2

The first address names the network and the last is broadcast, so neither goes to a device. /31 point-to-point links (RFC 3021) and /32 single hosts are the exceptions: a /31 has two usable addresses and no broadcast, a /32 is one address.

When you give a host count instead of a size, the calculator picks the smallest block whose usable addresses cover it: 50 hosts need a /26, which has 62. A /27 would only hold 30. It never suggests a /31 or /32 for a host count; use those directly for a point-to-point link or a single address.

Worked example

A device at 192.168.1.130 with a /26 mask (255.255.255.192). The last octet, 130, is 10000010 in binary. Keep the first 2 bits (the network part) and zero the other 6: 10000000 = 128. So the network is 192.168.1.128, the broadcast is 128 + 63 = 191, and devices use .129 through .190: 62 addresses.

Sizes by prefix

Each prefix from /8 to /32 has its own page with the mask in binary and hex, how many fit in the private ranges, example networks and a worked example.

PrefixMaskUsable
/8255.0.0.016,777,214
/9255.128.0.08,388,606
/10255.192.0.04,194,302
/11255.224.0.02,097,150
/12255.240.0.01,048,574
/13255.248.0.0524,286
/14255.252.0.0262,142
/15255.254.0.0131,070
/16255.255.0.065,534
/17255.255.128.032,766
/18255.255.192.016,382
/19255.255.224.08,190
/20255.255.240.04,094
/21255.255.248.02,046
/22255.255.252.01,022
/23255.255.254.0510
/24255.255.255.0254
/25255.255.255.128126
/26255.255.255.19262
/27255.255.255.22430
/28255.255.255.24014
/29255.255.255.2486
/30255.255.255.2522
/31255.255.255.2542
/32255.255.255.2551

IPv6

Type an IPv6 address with its prefix length, like 2001:db8:abcd:12::7/64. The idea is the same: the prefix length fixes the leftmost bits. An IPv6 address is 128 bits, written as eight groups of four hex digits; the result uses the standard short form (RFC 5952): lower case, leading zeros dropped, and :: for the longest run of zero groups.

Three things differ from IPv4. There is no broadcast address, so the result shows the first and last address and the total instead of usable hosts. There are no dotted masks, only prefix lengths. And networks have a standard size: a LAN gets a /64, because interface identifiers are 64 bits and stateless autoconfiguration (SLAAC) only works on a /64. A /48 holds 65,536 (2^16) of them and a /56 holds 256; end sites are usually given one or the other (RFC 6177). Links between two routers can use a /127 (RFC 6164).

For 2001:db8:abcd:12::7/64: the network is 2001:db8:abcd:12::/64, the last address is 2001:db8:abcd:12:ffff:ffff:ffff:ffff, and the block holds 18,446,744,073,709,551,616 (2^64) addresses. It sits inside 2001:db8::/32, the prefix set aside for documentation.

IPv6 prefix pages, with what each size holds and the RFC rules for it:

Special address ranges

Some blocks are set aside for private networks, loopback, documentation and other uses, and are not routed on the public internet. The result tells you when your subnet falls in, or contains, one of these. The lists follow the IANA IPv4 and IPv6 Special-Purpose Address registries, plus multicast, IPv4's reserved 240.0.0.0/4 and IPv6's deprecated site-local range. IPv6 addresses outside these blocks are global unicast if they start with 2 or 3 (2000::/3); the rest is held in reserve by the IETF.

IPv4
BlockUse
0.0.0.0/8"This network"
0.0.0.0/32"This host on this network"
10.0.0.0/8Private-Use
100.64.0.0/10Shared Address Space
127.0.0.0/8Loopback
169.254.0.0/16Link Local
172.16.0.0/12Private-Use
192.0.0.0/24IETF Protocol Assignments
192.0.0.0/29IPv4 Service Continuity Prefix
192.0.0.8/32IPv4 dummy address
192.0.0.9/32Port Control Protocol Anycast
192.0.0.10/32Traversal Using Relays around NAT Anycast
192.0.0.170/32NAT64/DNS64 Discovery
192.0.0.171/32NAT64/DNS64 Discovery
192.0.2.0/24Documentation (TEST-NET-1)
192.31.196.0/24AS112-v4
192.52.193.0/24AMT
192.88.99.0/24Deprecated (6to4 Relay Anycast)
192.88.99.2/326a44-relay anycast address
192.168.0.0/16Private-Use
192.175.48.0/24Direct Delegation AS112 Service
198.18.0.0/15Benchmarking
198.51.100.0/24Documentation (TEST-NET-2)
203.0.113.0/24Documentation (TEST-NET-3)
224.0.0.0/4Multicast
240.0.0.0/4Reserved
255.255.255.255/32Limited Broadcast
IPv6
BlockUse
::/128Unspecified Address
::1/128Loopback Address
::ffff:0:0/96IPv4-mapped Address
64:ff9b::/96IPv4-IPv6 Translat.
64:ff9b:1::/48IPv4-IPv6 Translat.
100::/64Discard-Only Address Block
100:0:0:1::/64Dummy IPv6 Prefix
2001::/23IETF Protocol Assignments
2001::/32TEREDO
2001:1::1/128Port Control Protocol Anycast
2001:1::2/128Traversal Using Relays around NAT Anycast
2001:1::3/128DNS-SD Service Registration Protocol Anycast
2001:2::/48Benchmarking
2001:3::/32AMT
2001:4:112::/48AS112-v6
2001:10::/28Deprecated (previously ORCHID)
2001:20::/28ORCHIDv2
2001:30::/28Drone Remote ID Protocol Entity Tags (DETs) Prefix
2001:db8::/32Documentation
2002::/166to4
2620:4f:8000::/48Direct Delegation AS112 Service
3fff::/20Documentation
5f00::/16Segment Routing (SRv6) SIDs
fc00::/7Unique-Local
fe80::/10Link-Local Unicast
fec0::/10Site-Local (deprecated)
ff00::/8Multicast

References

  • RFC 4632, Classless Inter-domain Routing (CIDR): prefix notation and block sizes.
  • RFC 950, Internet Standard Subnetting Procedure; RFC 1878, Variable Length Subnet Table for IPv4.
  • RFC 1812, Requirements for IP Version 4 Routers: subnet masks must be contiguous.
  • RFC 3021, Using 31-Bit Prefixes on IPv4 Point-to-Point Links.
  • RFC 1918, Address Allocation for Private Internets.
  • RFC 4291, IP Version 6 Addressing Architecture; RFC 5952, A Recommendation for IPv6 Address Text Representation.
  • RFC 6164, Using 127-Bit IPv6 Prefixes on Inter-Router Links; RFC 7421, Analysis of the 64-bit Boundary in IPv6 Addressing.
  • IANA IPv4 and IPv6 Special-Purpose Address registries (RFC 6890) and the IANA IPv6 Address Space registry.

Embed this calculator

Free to use on your site. Paste this where the calculator should appear; preview it.