Home › Developer Tools › Subnet Mask Cheat Sheet

Subnet Mask Cheat Sheet

Every IPv4 prefix from /0 to /32 in one searchable table: dotted subnet mask, wildcard mask, binary and hex, total addresses and usable hosts, with notes on classful and special ranges. Click any row for the block size, example subnets and more.

Last updated:

CIDRSubnet maskBinaryHexWildcardAddressesUsable hostsNotes
Advertisement
Advertisement

How to use the Subnet Mask Cheat Sheet

  1. Scan the table or type a prefix, mask, wildcard or host count into Filter.
  2. Narrow the view with Show: class A, B or C ranges, or only the most used prefixes.
  3. Enter Hosts needed and press Find mask to jump to the smallest prefix that fits.
  4. Click a row (or use the arrow keys and Enter) to see binary bits, block size and example subnets.
  5. Download the CSV or copy the table to keep a printable cheat sheet.

How to read a subnet mask

An IPv4 subnet mask is 32 bits: a run of 1s for the network part followed by 0s for the host part. The CIDR prefix simply counts the 1s. Because the 1s are always contiguous, each octet of a mask can only be one of nine values:

Octet valueBinary1-bitsBlock size (256 − value)
0000000000256
128100000001128
19211000000264
22411100000332
24011110000416
2481111100058
2521111110064
2541111111072
2551111111181

Subnetting shortcuts

  • Addresses = 232 − prefix. Each step of the prefix halves (or doubles) the size.
  • Usable hosts = addresses − 2, except /31 (2, RFC 3021) and /32 (1).
  • Block size in the interesting octet = 256 − mask value. Network addresses are multiples of the block size.
  • Broadcast = next network address − 1. First host = network + 1, last host = broadcast − 1.
  • Wildcard = 255 − each mask octet.

Example: which subnet does 172.16.45.200/27 belong to? The mask is 255.255.255.224, block size 32. 200 lies between 192 and 224, so the network is 172.16.45.192, the broadcast 172.16.45.223 and the hosts .193 to .222.

Special IPv4 blocks worth memorising

BlockPurpose
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16Private networks (RFC 1918)
100.64.0.0/10Carrier-grade NAT shared space (RFC 6598)
127.0.0.0/8Loopback
169.254.0.0/16Link-local (automatic addressing)
192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24Documentation examples (RFC 5737)
224.0.0.0/4Multicast
240.0.0.0/4Reserved (former Class E)

Frequently asked questions

How many hosts are in each subnet?

A prefix /n has 2^(32 − n) addresses; subtract 2 for the network and broadcast addresses to get usable hosts. So /24 has 254 usable hosts, /26 has 62, /28 has 14 and /30 has 2. /31 (2 hosts on point-to-point links) and /32 (1 host) are exceptions.

How do I convert a CIDR prefix to a subnet mask?

Write n one-bits followed by 32 − n zero-bits and convert each group of 8 bits to decimal. /20 is 11111111.11111111.11110000.00000000, which is 255.255.240.0. The only octet values a mask can contain are 0, 128, 192, 224, 240, 248, 252, 254 and 255.

What is the block size of a subnet?

It is 256 minus the mask value in the interesting octet, the last octet that is not 255. For 255.255.255.224 the block size is 32, so networks start at .0, .32, .64, .96 and so on. This is the quickest way to subnet in your head.

What are the classful default masks?

Class A (first octet 1-126) used 255.0.0.0 (/8), Class B (128-191) used 255.255.0.0 (/16) and Class C (192-223) used 255.255.255.0 (/24). Classful addressing was replaced by CIDR in 1993, but the terms are still used to describe network sizes.

What is a wildcard mask in the table?

The wildcard mask is the subnet mask with every bit inverted, i.e. 255.255.255.255 minus the mask. Cisco ACLs and OSPF network statements use it, so /24 appears as 0.0.0.255.

Which subnet sizes are used most?

/24 for typical LANs, /25 to /28 for smaller VLANs and server segments, /29 for small static IP blocks, /30 or /31 for router-to-router links, /32 for host routes and loopbacks, and /16 or larger for whole private address plans.

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

Subnet CalculatorCalculate IPv4 network, broadcast, host range, masks and host count, and split subnets.Wildcard Mask CalculatorConvert a subnet mask or CIDR to a wildcard mask for ACLs and OSPF, with range and binary.VLSM CalculatorSplit a network into variable-length subnets sized to the hosts each one needs.CIDR to IP RangeConvert IPv4 or IPv6 CIDR blocks to first/last IP, mask and host count, and export IP lists.Email ValidatorCheck email lists and spot disposable addresses.Website Down CheckerCheck if a website is down for everyone.Deep Link GeneratorCreate links that open directly in apps.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.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.DNS Propagation CheckerCompare DNS answers and TTLs from Cloudflare, Google, Quad9, AdGuard and NextDNS side by side.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.ASN LookupLook up an AS number or IP: network owner, country, registry, abuse contact and announced prefixes.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.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.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.TXT Record LookupLook up a domain’s DNS TXT records and see which are SPF, DMARC, DKIM or verification tokens.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 Blacklist CheckerCheck an IPv4 address against 21 public spam blocklists (DNSBLs) and see listed or clean.IP Range to CIDRTurn a start and end IP into the shortest list of CIDR blocks, for IPv4 and IPv6.
See all 52 Network, DNS & Email Tools →