Home › Developer Tools › Subnet Calculator

Subnet Calculator

Type an IPv4 address with a prefix like /24 or a netmask like 255.255.255.0. You instantly get the network and broadcast addresses, usable host range, masks and a binary view, and you can split the network into smaller subnets.

Last updated:

Try:
Network address–
Broadcast address–
First usable host–
Last usable host–
Usable hosts–
Subnet mask–
Wildcard mask–
Address type–
IP address–
Host range–
Hex (IP / network)–
Integer (IP)–
Reverse DNS zone–

Binary view

network bitshost bits

Split into subnets

Advertisement
Advertisement

How to use the Subnet Calculator

  1. Enter an IPv4 address with its prefix, for example 192.168.1.10/24, or an address and netmask such as 192.168.1.10 255.255.255.0.
  2. Or pick the prefix from the list, which also shows each prefix's netmask and size.
  3. Press Calculate Subnet (results also update as you type) and read the network, broadcast and host range.
  4. Check the binary view to see which bits belong to the network (green) and which to hosts (orange).
  5. Split the network: choose a longer prefix or enter how many hosts each subnet needs, press Split Subnet and download the list as CSV.

Subnet formulas

  • Network address = IP AND mask
  • Broadcast address = network OR wildcard (wildcard = NOT mask)
  • Total addresses = 232 − prefix; usable hosts = total − 2 (except /31 = 2 and /32 = 1)
  • First host = network + 1; last host = broadcast − 1

Worked example for 172.16.5.4/20: the mask has 20 one-bits, 255.255.240.0. The third octet 5 is 00000101; AND with 240 (11110000) gives 0, so the network is 172.16.0.0. The wildcard is 0.0.15.255, so the broadcast is 172.16.0.0 OR 0.0.15.255 = 172.16.15.255. There are 212 = 4,096 addresses and 4,094 usable hosts, from 172.16.0.1 to 172.16.15.254.

CIDR prefix reference

PrefixNetmaskWildcardAddressesUsable hosts
/8255.0.0.00.255.255.25516,777,21616,777,214
/12255.240.0.00.15.255.2551,048,5761,048,574
/16255.255.0.00.0.255.25565,53665,534
/20255.255.240.00.0.15.2554,0964,094
/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 (point-to-point, RFC 3021)
/32255.255.255.2550.0.0.011 (single host)

Special-purpose IPv4 ranges

RangeUse
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16Private networks (RFC 1918), not routed on the internet
100.64.0.0/10Carrier-grade NAT shared address space (RFC 6598)
127.0.0.0/8Loopback (localhost)
169.254.0.0/16Link-local, self-assigned when DHCP fails
192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24Documentation and examples (RFC 5737)
198.18.0.0/15Network benchmark testing
224.0.0.0/4Multicast
240.0.0.0/4Reserved; 255.255.255.255 is the limited broadcast address

Splitting a network into subnets

Borrowing k host bits creates 2k subnets. Splitting 192.168.1.0/24 into /26 borrows 2 bits and gives 4 subnets of 64 addresses: 192.168.1.0/26, .64/26, .128/26 and .192/26, each with 62 usable hosts. To size a subnet for h hosts, pick the smallest block where 232 − prefix − 2 ≥ h: 50 hosts need a /26 (62 usable), 100 hosts a /25 (126 usable) and 300 hosts a /23 (510 usable).

Frequently asked questions

How do I calculate the network address?

Write the IP address and subnet mask in binary and AND them together. For 192.168.1.10/24 the mask is 255.255.255.0, so the network address is 192.168.1.0. The broadcast address sets all host bits to 1: 192.168.1.255.

How many usable hosts does a subnet have?

A prefix of /n has 2^(32 − n) addresses. Normally the first (network) and last (broadcast) address cannot be assigned, so usable hosts = 2^(32 − n) − 2. A /24 has 256 addresses and 254 usable hosts. /31 and /32 are special cases.

Why does a /31 show 2 usable hosts?

RFC 3021 allows /31 networks on point-to-point links. With only two addresses there is no need for a network or broadcast address, so both are usable hosts. A /32 identifies a single host, for example a loopback interface or a firewall rule.

What is a wildcard mask?

It is the inverse of the subnet mask: each bit is flipped, so 255.255.255.0 becomes 0.0.0.255. Cisco access lists and OSPF network statements use wildcard masks, where a 0 bit means “must match” and a 1 bit means “any value”.

What is the difference between CIDR and a netmask?

They describe the same thing. CIDR notation counts the network bits (/24), while a dotted netmask writes them as four octets (255.255.255.0). A valid netmask always has all 1 bits first, followed by 0 bits.

Which addresses are private?

RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks. 100.64.0.0/10 is shared address space for carrier-grade NAT, 127.0.0.0/8 is loopback and 169.254.0.0/16 is link-local. The calculator labels these and other special ranges.

Does this tool support IPv6?

This calculator is for IPv4. To expand or compress IPv6 addresses, use an IPv6 expander and compressor. Everything here is calculated in your browser.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

URL ParserBreak a URL into its parts and edit query string parameters with a live rebuild.User Agent ParserSee your user agent and parse any UA string into browser, OS, engine and device.Website Down CheckerCheck if a website is down for everyone.Binary TranslatorConvert text to binary, hex, octal and back.ASN LookupLook up an AS number or IP: network owner, country, registry, abuse contact and announced prefixes.Bitwise CalculatorCalculate AND, OR, XOR, NOT and bit shifts at 8–64 bits with a bit grid and all bases.Bufferbloat TestMeasure lag under load: idle vs loaded latency, graded A+ to F with a latency chart.Chmod CalculatorConvert Linux file permissions between checkboxes, octal (755) and symbolic (rwxr-xr-x) notation.Email ValidatorCheck email lists and spot disposable addresses.Deep Link GeneratorCreate links that open directly in apps.HTTP Status CodesSearch every HTTP status code with plain-English meanings, causes, fixes and RFC references.Bulk URL OpenerOpen a list of URLs in new tabs at once or in batches, with cleanup, dedupe and delay.DNS LookupLook up A, AAAA, MX, TXT, NS, CNAME, SOA and CAA records with TTLs over secure DNS.API Request TesterSend GET, POST, PUT and DELETE requests with headers and a body, then inspect the response.WebSocket TesterConnect to a ws:// or wss:// server, send messages and watch a timestamped live log.WHOIS LookupLook up who registered a domain or IP: registrar, creation and expiry dates, name servers, status.Mailto Link GeneratorBuild encoded mailto: links with cc, bcc, subject and body, plus HTML code and a QR code.WhatsApp Link GeneratorCreate wa.me click-to-chat links with a pre-filled message, button HTML and a QR code.Basic Auth Header GeneratorCreate an Authorization: Basic header from a username and password, or decode one.Common Ports ListSearchable TCP/UDP port number list with service, protocol and description, filterable by range.DMARC CheckerLook up a domain's DMARC record, explain every tag, grade the policy and get fix suggestions.DMARC Record GeneratorCreate a DMARC TXT record with policy, reporting and alignment options, every tag explained.Email Header AnalyzerPaste raw email headers to trace every server hop, see delays and check SPF, DKIM and DMARC.IP Geolocation LookupFind the country, city, ISP, ASN and time zone of any IP address or domain, with a map.Reverse DNS LookupFind the PTR hostname of any IPv4 or IPv6 address, one at a time or hundreds in bulk.SPF Record CheckerLook up a domain's SPF record, count nested DNS lookups, find errors and test a sender IP.SPF Record GeneratorBuild a valid SPF TXT record from mail providers, IPs and includes, with a lookup-count check.CIDR to IP RangeConvert IPv4 or IPv6 CIDR blocks to first/last IP, mask and host count, and export IP lists.Domain Availability CheckerCheck if domain names are available across .com, .io, .ai and more, with registrar and expiry.MAC Address LookupFind the vendor of a MAC address or OUI, check multicast and random bits, look up many at once.MX LookupFind a domain's mail servers: MX priority, host, IP addresses and the email provider.Uptime SLA CalculatorTurn 99.9% uptime into allowed downtime per day, month and year, or downtime into uptime %.Website Speed TestTest page speed with Lighthouse: performance score, Core Web Vitals and fixes, mobile or desktop.Bandwidth CalculatorEstimate monthly website bandwidth (GB) and the Mbps you need from page views and page size.CNAME LookupFollow a hostname's full CNAME chain to its final IP addresses, with TTLs and CDN detection.CORS TesterSend GET, POST or OPTIONS from your browser to any API and see whether CORS allows it and why not.DKIM Record CheckerLook up a domain's DKIM key by selector (or auto-detect), check key type, bit length and tags.DKIM Record GeneratorCreate a DKIM RSA key pair in your browser with the TXT record, selector host and private key PEM.NS LookupFind a domain's authoritative nameservers with their IPs, SOA record and DNS hosting provider.Social Share Link GeneratorMake share links and buttons for Facebook, X, LinkedIn, Reddit, Pinterest, WhatsApp and email.Subnet Mask Cheat SheetInteractive /0 to /32 table of subnet masks, wildcards and host counts with details per prefix.TXT Record LookupLook up a domain’s DNS TXT records and see which are SPF, DMARC, DKIM or verification tokens.VLSM CalculatorSplit a network into variable-length subnets sized to the hosts each one needs.YouTube Timestamp Link GeneratorMake YouTube links that start at a set time, embed start/end codes and lists of timestamps.DMARC Report AnalyzerRead DMARC aggregate XML reports (.xml, .gz, .zip): sources, SPF/DKIM alignment and pass rates.Domain Age CheckerSee how old a domain is, when it was registered and when it expires. Bulk check up to 50.Email Deliverability CheckerGrade a domain's MX, SPF, DMARC, DKIM, BIMI and MTA-STS records in one report with fixes.Email ObfuscatorHide an email address from spam bots with HTML entities, a JavaScript mailto link or reversed CSS text.Email PermutatorGenerate every common business email format from a first name, last name and company domain.HTTP Header ParserPaste raw HTTP headers to get a table explaining each one plus a security headers grade.IP Range to CIDRTurn a start and end IP into the shortest list of CIDR blocks, for IPv4 and IPv6.IPv6 Subnet CalculatorIPv6 prefix to network, range, address count and /64s, and split it into child subnets.Link in Bio Page GeneratorCreate a link-in-bio page with avatar, bio, links and theme, then download it as one HTML file.
See all 52 Network, DNS & Email Tools →