Skip to content

Subnet Calculator

IPv4 and IPv6 CIDR calculator with subnet splitting. Runs in your browser.

Loading tool…

About this subnet calculator

This subnet calculator takes an IPv4 or IPv6 address with a prefix, such as 192.168.1.10/24 or 2001:db8::1/64, and gives you the network address, broadcast address, usable host range, subnet mask, wildcard mask and a binary view of the bits. It is for network engineers planning address space, students learning subnetting, and developers setting up VPCs, firewalls or Docker networks.

You can type a prefix (/26), a dotted mask (255.255.255.192) or pick from the list. The calculator tells you what kind of address it is, from RFC 1918 private ranges to carrier-grade NAT, and can split the network into smaller subnets and copy the list as CSV.

All of it runs in your browser. No address you type is sent anywhere.

Features

  • IPv4 and IPv6

    Detected automatically. IPv6 accepts :: shorthand, embedded IPv4 (::ffff:192.0.2.1), brackets and zone IDs such as %eth0, and prints the RFC 5952 short form and the full expanded form.

  • All the usual numbers

    Network, broadcast, first and last usable host, total and usable host counts, subnet mask, wildcard mask, hex and integer forms, and the IPv4-mapped IPv6 address.

  • Masks or prefixes

    Enter 10.1.2.3 255.255.240.0 and it reads /20. A wildcard mask such as 0.0.0.255 is recognised and you are told the subnet mask it stands for. Non-contiguous masks are rejected with a clear message.

  • Address type

    Private, loopback, link-local, shared CGNAT space, documentation, benchmarking, multicast and reserved ranges, each with its RFC, from the IANA special-purpose registries. IPv6 adds ULA, Teredo, 6to4, NAT64 and the new 3fff::/20 documentation block.

  • Binary view

    Address, mask, network and broadcast written in binary with the network bits in blue, so you can see exactly where the prefix cuts.

  • Subnet splitting

    Pick a longer prefix to divide the network: a /24 into four /26s, or a /48 into 65,536 /64s. The subnet holding your address is highlighted, and the list copies as CSV.

  • Reverse DNS

    The PTR name for the address and the in-addr.arpa or ip6.arpa zone for the prefix, when it falls on an 8-bit (IPv4) or 4-bit (IPv6) boundary.

How to use the subnet calculator

  1. 1Enter an address with a prefix or mask, such as 192.168.1.10/24.
  2. 2Read the network, broadcast, usable range, masks, type and binary view.
  3. 3Pick a longer prefix to split the network and copy the subnet list.

When to use it

  • Planning a VPC

    Start with 10.0.0.0/16, split into /20s for each availability zone, and copy the CSV into your Terraform notes. Cloud providers keep a few addresses per subnet for themselves, so leave room.

  • Writing a firewall rule or ACL

    Check that 172.16.5.4/20 really covers 172.16.0.0 to 172.16.15.255 before you allow it, and copy the wildcard mask for a Cisco ACL.

  • Studying for CCNA or Network+

    Work out the answer on paper, then check the network, broadcast and host count here. The binary view shows why the answer is right.

  • Sizing an IPv6 site

    A /48 from your provider gives 65,536 /64 LANs. Split it into /52s or /56s to plan per-building or per-region blocks.

How do you calculate a subnet?

Write the address and the mask in binary. The prefix length says how many leading bits belong to the network. AND the address with the mask to get the network address. Set all the host bits to 1 to get the broadcast address. Every address in between can be given to a host.

Take 192.168.10.77/26. A /26 mask is 255.255.255.192, which leaves 6 host bits, so each block has 2^6 = 64 addresses. 77 falls in the block that starts at 64, so the network is 192.168.10.64, the broadcast is 192.168.10.127, and hosts run from .65 to .126: 62 usable addresses.

CIDR cheat sheet

The number of addresses doubles for every bit you remove from the prefix. Usable hosts are the total minus the network and broadcast addresses, except on /31 and /32.

  • /8: mask 255.0.0.0, 16,777,216 addresses, 16,777,214 usable hosts
  • /12: mask 255.240.0.0, 1,048,576 addresses, 1,048,574 usable hosts
  • /16: mask 255.255.0.0, 65,536 addresses, 65,534 usable hosts
  • /20: mask 255.255.240.0, 4,096 addresses, 4,094 usable hosts
  • /22: mask 255.255.252.0, 1,024 addresses, 1,022 usable hosts
  • /23: mask 255.255.254.0, 512 addresses, 510 usable hosts
  • /24: mask 255.255.255.0, 256 addresses, 254 usable hosts
  • /25: mask 255.255.255.128, 128 addresses, 126 usable hosts
  • /26: mask 255.255.255.192, 64 addresses, 62 usable hosts
  • /27: mask 255.255.255.224, 32 addresses, 30 usable hosts
  • /28: mask 255.255.255.240, 16 addresses, 14 usable hosts
  • /29: mask 255.255.255.248, 8 addresses, 6 usable hosts
  • /30: mask 255.255.255.252, 4 addresses, 2 usable hosts
  • /31: mask 255.255.255.254, 2 addresses, 2 usable hosts
  • /32: mask 255.255.255.255, 1 addresses, 1 usable hosts

What are /31 and /32 used for?

A /32 is a single address. It is used for loopback interfaces, host routes and firewall rules that match one machine.

A /31 has only two addresses. Normally both would be lost to the network and broadcast addresses, but RFC 3021 allows /31 on point-to-point links with no broadcast, so both ends get an address. It saves half the space compared to the older habit of using a /30 for every link.

How is IPv6 subnetting different?

IPv6 has no broadcast address, so every address in a prefix can be assigned and there is no minus two. The other big difference is scale: a single /64 holds 2^64, about 18.4 quintillion addresses. You never subnet IPv6 to save addresses. You subnet it to organise networks.

The standard size for one LAN is /64, because SLAAC address autoconfiguration needs a 64-bit interface ID. Sites usually get a /48 (65,536 LANs) or a /56 (256 LANs) from their provider, and point-to-point links can use /127 as RFC 6164 recommends. To read an IPv6 address faster, remember that each hex digit is four bits, so prefixes on a multiple of 4 line up with digit boundaries.

Why use Mavros

 MavrosTypical upload sites
IP versionsIPv4 and IPv6 in one box, detected automaticallySeparate pages
InputPrefix, dotted mask, wildcard detection, zone IDsPrefix dropdown only
Address typeEvery IANA special-purpose range with its RFCPrivate or public
Binary viewNetwork bits highlightedPlain binary or none
SplittingAny longer prefix, CSV export, your subnet highlightedRare, or a fixed number of rows
Reverse DNSPTR name and zoneNot shown

Tips

  • Private ranges are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (RFC 1918). 100.64.0.0/10 looks private but is reserved for carrier-grade NAT, so avoid it in your own LAN.
  • Use 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 and 2001:db8::/32 in documentation and examples. They are reserved for that and will never route on the internet.
  • Overlapping subnets break VPNs and VPC peering. Plan the whole address space before you create the first network.
  • Need your current public address to plug in? Find it with what is my IP, and look up who owns another one with the IP lookup.
  • Converting a mask or address to binary or hex by hand? The number base converter shows each step.

Questions

How many hosts are in a /24 subnet?

254 usable hosts. A /24 has 256 addresses (2^8), and the first is the network address and the last is the broadcast address, which hosts cannot use.

What is the subnet mask for /24?

255.255.255.0. The first 24 bits are 1 and the last 8 are 0. A /16 is 255.255.0.0 and a /8 is 255.0.0.0.

How do I find the network address?

Do a bitwise AND of the IP address and the subnet mask. For 192.168.10.77 with 255.255.255.192, the result is 192.168.10.64. The calculator shows this in the binary view.

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

A wildcard mask is the subnet mask with every bit inverted: 255.255.255.0 becomes 0.0.0.255. A 0 bit means "must match" and a 1 bit means "any value". Cisco ACLs and OSPF network statements use wildcard masks.

What does CIDR stand for?

Classless Inter-Domain Routing, defined in RFC 4632. It replaced the old class A, B and C system, letting a prefix be any length, so you can write 10.0.0.0/22 instead of being stuck with /8, /16 or /24.

Is 172.20.0.1 a private IP address?

Yes. 172.16.0.0/12 covers 172.16.0.0 to 172.31.255.255, and it is one of the three RFC 1918 private ranges. 172.32.0.1, just outside it, is a public address.

What is a /64 in IPv6?

A prefix where the first 64 bits identify the network and the last 64 identify the interface. It is the standard size for one LAN segment and holds 18,446,744,073,709,551,616 addresses.

Why are there only 2 usable addresses in a /30?

A /30 has 4 addresses. One is the network address and one is the broadcast address, leaving 2 for hosts, which is why /30 was the classic size for a router-to-router link. /31 now does the same job with no waste.