Home › Developer Tools › Wildcard Mask Calculator

Wildcard Mask Calculator

Enter a subnet mask such as 255.255.240.0 or a prefix like /20 and get the wildcard (inverse) mask used in access lists and OSPF or EIGRP network statements. Add a network address to see exactly which IPs it matches.

Last updated:

Start from

Dotted mask (255.255.240.0) or prefix (/20 or 20)

Non-contiguous wildcards such as 0.0.254.255 are allowed

Used for the matching range and the commands

Command options

1 to 99; the extended example uses a number from 100 to 199

Enter your values to see the result.
Advertisement
Advertisement

How to use the Wildcard Mask Calculator

  1. Choose what you have: a subnet mask/CIDR prefix, or a wildcard mask.
  2. Type the mask, for example 255.255.255.224, /27 or 0.0.0.31.
  3. Add a network address (optional) to see the first and last IP the wildcard matches.
  4. Press Calculate wildcard mask and read the wildcard, prefix and address count.
  5. Copy the commands for your ACL, OSPF or EIGRP configuration, adjusting the ACL number and area if needed.

Wildcard mask formula

A wildcard mask is the bitwise inverse of a subnet mask: wildcard = 255.255.255.255 − subnet mask, octet by octet. Where the subnet mask has a 1 bit (network part), the wildcard has a 0 bit ("must match"), and where the mask has a 0 bit (host part), the wildcard has a 1 bit ("don't care").

Example: a /21 network uses the mask 255.255.248.0. Subtracting each octet from 255 gives 0.0.7.255. With the network 10.20.8.0, the wildcard matches 211 = 2,048 addresses, from 10.20.8.0 to 10.20.15.255, and the OSPF line is network 10.20.8.0 0.0.7.255 area 0.

Common wildcard masks

PrefixSubnet maskWildcard maskAddresses matched
/8255.0.0.00.255.255.25516,777,216
/16255.255.0.00.0.255.25565,536
/20255.255.240.00.0.15.2554,096
/22255.255.252.00.0.3.2551,024
/23255.255.254.00.0.1.255512
/24255.255.255.00.0.0.255256
/25255.255.255.1280.0.0.127128
/26255.255.255.1920.0.0.6364
/27255.255.255.2240.0.0.3132
/28255.255.255.2400.0.0.1516
/29255.255.255.2480.0.0.78
/30255.255.255.2520.0.0.34
/32255.255.255.2550.0.0.01 (host)

Tips for ACLs and OSPF

  • Standard ACLs (1-99) match only the source address; extended ACLs (100-199) can match source, destination, protocol and ports, each with its own wildcard.
  • Every ACL ends with an invisible deny any, so add the permit lines you need before applying it to an interface.
  • In OSPF, the wildcard in a network statement selects which interfaces join the area; 0.0.0.0 after an interface IP enables exactly that one interface.
  • Mixing 0 and 1 bits (non-contiguous wildcards) is allowed in ACLs but makes rules hard to read: document them well.

Frequently asked questions

How do you calculate a wildcard mask?

Subtract each octet of the subnet mask from 255. For 255.255.255.192 that gives 0.0.0.63. In binary, every bit is flipped: the network bits (1s in the mask) become 0s, and the host bits become 1s.

What is the wildcard mask for /24?

A /24 has the subnet mask 255.255.255.0, so its wildcard mask is 0.0.0.255. It matches all 256 addresses whose first three octets equal the network address, for example 192.168.10.0 to 192.168.10.255.

What do 0 and 1 mean in a wildcard mask?

A 0 bit means the corresponding bit of the address must match the value in the statement. A 1 bit means that bit can be anything. So 0.0.0.0 matches one exact host and 255.255.255.255 matches every address.

Is a wildcard mask the same as an inverse mask?

For contiguous masks, yes: the inverse mask is the bitwise NOT of the subnet mask, and that is what OSPF and EIGRP network statements use. ACLs go further and allow non-contiguous wildcards, where 0 and 1 bits can be mixed.

What is a non-contiguous wildcard mask used for?

It lets one ACL line match a pattern instead of a single block, for example 10.1.0.0 0.0.254.255 matches every subnet 10.1.x.0/24 whose third octet is even. Such wildcards have no matching subnet mask and are not accepted by routing protocol network statements.

Why does the router change my ACL address?

If the address has bits set where the wildcard has 1s, those bits are ignored, so IOS stores the normalised address. 192.168.10.77 0.0.0.255 is saved as 192.168.10.0 0.0.0.255. This calculator shows the normalised value too.

How do I write a wildcard for a single host or any host?

Use 0.0.0.0 for a single host, which IOS lets you write as host 10.1.1.5. Use 255.255.255.255 with 0.0.0.0 to match everything, written as the keyword any.

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.Subnet Mask Cheat SheetInteractive /0 to /32 table of subnet masks, wildcards and host counts with details per prefix.CIDR to IP RangeConvert IPv4 or IPv6 CIDR blocks to first/last IP, mask and host count, and export IP lists.VLSM CalculatorSplit a network into variable-length subnets sized to the hosts each one needs.JSON to Excel ConverterTurn JSON into a styled .xlsx spreadsheet; nested arrays become their own linked sheets.JSON to CSVConvert JSON data to CSV for spreadsheets.CSV to JSONConvert CSV data to JSON with live preview.Excel to CSVConvert XLSX spreadsheets to CSV.CSV ViewerOpen a CSV or TSV file as a sortable, filterable table.Excel Viewer (XLSX / XLS)Open XLSX, XLS and ODS spreadsheets in your browser without Excel.Line Ending ConverterConvert text and files between CRLF, LF and CR line endings.Markdown to HTMLConvert Markdown to clean HTML with a live editor.XML to JSONConvert XML to JSON with validation.Text Encoding ConverterDetect and convert text file encodings like UTF-8, UTF-16 and Latin-1.JSON ViewerExplore JSON as a collapsible tree, search keys and values and copy any node's path.TTF to WOFF2 ConverterConvert TTF and OTF fonts to WOFF2 or WOFF and get a ready @font-face CSS snippet.Chmod CalculatorConvert Linux file permissions between checkboxes, octal (755) and symbolic (rwxr-xr-x) notation.JSON to TypeScriptGenerate TypeScript interfaces or types from JSON, with nested types and optional fields.Morse Code TranslatorTranslate text to Morse code and back, then play it as sound or a blinking light, or save a WAV.HTML Table GeneratorBuild HTML tables in an editable grid with styles, header rows, CSV import and live preview.Hex to Text ConverterConvert hex to text and text to hex with UTF-8 support and space, 0x, \x or comma formats.JSON to XML ConverterConvert JSON to well-formed XML with attributes, arrays and pretty print.JSON to YAML ConverterConvert JSON to clean YAML as you type, with indent, quoting and sort options.YAML to JSON ConverterConvert YAML to pretty or minified JSON, with errors pinned to the exact line.HTML to Markdown ConverterTurn HTML or pasted rich text into clean Markdown with tables and live preview.Markdown Table GeneratorBuild Markdown tables in a grid or paste from Excel/CSV, with alignment and preview.JSON ValidatorCheck JSON with the exact line and column of each error, fix tips and one-click auto-fix.Image to Base64Convert images to Base64 data URIs, CSS backgrounds and HTML img tags in your browser.Base64 to ImagePaste a Base64 string or data URI to preview, identify and download the image.JSON CompareCompare two JSON documents and see every added, removed and changed path.Hex to DecimalConvert hex to decimal instantly with steps and signed mode.Decimal to HexConvert decimal to hex instantly with steps and signed mode.Binary to DecimalConvert binary to decimal instantly with steps and signed mode.Decimal to BinaryConvert decimal to binary instantly with steps and signed mode.Two's Complement CalculatorDecimal to two's complement binary and back for 4-64 bits, with invert-and-add-1 steps.XML to CSV ConverterConvert XML to CSV: detects repeating records, flattens nested data, pick your columns.CSV to XML ConverterConvert CSV to well-formed XML with custom root and row names, escaping and pretty print.TOML to JSON ConverterConvert TOML to JSON and JSON to TOML with a full v1.0 parser and clear error lines.ES6 to ES5 ConverterTranspile modern JavaScript (ES2015+) to ES5 with Babel: targets, module format and loose mode.JavaScript Object to JSONTurn JS object literals and Python dicts into valid JSON: quotes keys, fixes commas and values.JSON Graph VisualizerSee JSON as an interactive node graph with zoom, collapse and search; export PNG or SVG.KML ViewerOpen KML and KMZ files on an interactive map: placemarks, paths, polygons, folders, export.MySQL to PostgreSQL ConverterConvert MySQL dumps and CREATE TABLE statements to PostgreSQL: types, AUTO_INCREMENT, ENUMs, quotes.Text to CSV ConverterTurn space-aligned, fixed-width, pipe or tab separated text into clean CSV with a live preview.VCF File ViewerOpen vCard .vcf files as contact cards with photos, search and duplicate check, export CSV.XML ViewerBrowse XML as a collapsible tree with search, XPath of any node, attributes and big-file support.JSON to Go StructTurn JSON into Go structs with inferred types, nested structs and json tags.JSON to Python ClassGenerate Python dataclasses, Pydantic models or TypedDicts with type hints from JSON.JSON to C# ClassConvert JSON to C# classes or records with System.Text.Json or Newtonsoft attributes.JSON SorterSort JSON keys A-Z recursively, sort arrays by value or by a key, then pretty-print or minify.JSON to HTML TableConvert a JSON array of objects into clean HTML table code with CSS styles and a live preview.CSV to SQL ConverterConvert CSV to SQL CREATE TABLE and INSERT statements for MySQL, PostgreSQL, SQLite or SQL Server.IPv4 to IPv6 ConverterConvert IPv4 to IPv4-mapped, 6to4 and NAT64 IPv6, extract IPv4 from IPv6, and get int/hex/binary.cURL to Code ConverterConvert curl commands to JavaScript fetch, Axios, Python requests, Node.js, PHP and Go code.Code to ImageTurn code into a beautiful syntax-highlighted PNG with themes, window frame and background.Excel to JSON ConverterConvert Excel sheets (XLSX, XLS, ODS) to JSON with header row, type and shape options.CSV to Excel ConverterConvert CSV files to a real .xlsx workbook with typed numbers and dates, one sheet per file.CSV SplitterSplit a large CSV into smaller files by row count, file count or column value, header kept.CSV MergerCombine many CSV files into one, matching columns by name, with dedupe and a source column.VCF to CSV ConverterConvert vCard (.vcf) contacts to CSV for Google or Outlook, or turn a CSV back into a VCF.Calendar Event (.ics) GeneratorCreate an .ics calendar invite with time zone, reminders and repeats + Google/Outlook links.CSV Column ExtractorPick, reorder and rename CSV columns, filter rows by value, and export a new CSV or JSON.CSV Diff CheckerCompare two CSV files by key column and see added, removed and changed rows cell by cell.CSV Duplicate Row RemoverRemove duplicate rows from a CSV by all or selected columns and download the cleaned file.CSV to HTML TableTurn CSV into clean HTML table code with a live preview, styling options and one-click copy.CSV to Markdown TableConvert CSV to a neatly aligned GitHub Markdown table with column alignment and live preview.CSV TransposeSwap rows and columns of CSV, TSV or pasted spreadsheet data, with delimiter auto-detect.Date Format ConverterConvert any date to ISO 8601, RFC 2822, Unix time and custom strftime, moment or Java patterns.
See all 129 Data & File Format Converters →