Free network calculator

Free Subnet Mask Calculator Online

Enter an IPv4 CIDR prefix or dotted-decimal mask to convert its formats and calculate capacity, block size, and optional address-range details.

Enter /24, 24, or 255.255.255.0. Add an IPv4 address for network boundaries.

What Is a Subnet Mask Calculator?

A subnet mask calculator converts an IPv4 CIDR prefix into a dotted-decimal mask, or converts a valid dotted mask back into CIDR notation. For example, /24 and 255.255.255.0 describe the same division between network bits and host bits.

A subnet mask contains 32 binary bits. Bits set to 1 identify the network portion of an address. Bits set to 0 identify the host portion. A valid mask is contiguous, which means all network ones appear before all host zeros. The prefix and mask relationship is described in RFC 4632. A value such as 255.0.255.0 is not a valid subnet mask because its ones and zeros are interrupted.

The calculator from ipdnslookup also shows the wildcard mask, binary and hexadecimal forms, address capacity, block size, and changing octet. You can optionally enter an IPv4 address to calculate the matching network, broadcast address, usable range, address position, and adjacent same-size subnets.

How to Use the Subnet Mask Calculator

  1. Enter a mask: Type a prefix such as /24 or 24, or enter a dotted mask such as 255.255.255.0.
  2. Add an IPv4 address: This field is optional. Enter an address such as 192.168.1.25 when you also need network boundaries.
  3. Select Calculate Mask: The calculator validates the input and converts it into the supported mask formats.
  4. Review the main result: Read the dotted subnet mask and CIDR prefix first.
  5. Check capacity: Compare network bits, host bits, total addresses, usable hosts, block size, and wildcard mask.
  6. Use network context: If you supplied an IP address, review the network, broadcast, usable range, and adjacent blocks.

Example subnet mask calculation

Mask input: /27

Optional IPv4 address: 192.168.10.45

Calculated result: The dotted mask is 255.255.255.224 and the wildcard mask is 0.0.0.31. A /27 has 27 network bits, 5 host bits, 32 total addresses, and 30 traditionally usable hosts. The entered address belongs to 192.168.10.32/27. Its broadcast address is 192.168.10.63, and its traditional usable range is 192.168.10.33 through 192.168.10.62.

Why Use Our Subnet Mask Calculator?

  • Flexible mask input: Enter CIDR with or without a slash, or use dotted-decimal notation.
  • Strict validation: Non-contiguous masks and prefixes outside /0 through /32 are rejected.
  • Multiple formats: See dotted, wildcard, binary, hexadecimal, and integer representations.
  • Capacity details: Compare total addresses with the traditional usable-host count.
  • Planning values: Use the changing octet and block size to identify subnet boundaries.
  • Optional network analysis: Add an IPv4 address only when you need its complete range.
  • Direct calculation: Results are calculated immediately without sending the values to an external calculation API.

How Subnet Mask Calculation Works

IPv4 addresses and masks each contain 32 bits arranged as four groups of eight. A CIDR prefix states how many leading mask bits are set to 1. A /24 therefore contains 24 network ones followed by 8 host zeros. Written in binary, it is 11111111.11111111.11111111.00000000. Converting each eight-bit group to decimal produces 255.255.255.0.

The host-bit count is calculated as 32 minus the prefix. The total address count is 2 raised to the number of host bits. A /27 leaves 5 host bits, so its capacity is 25, or 32 addresses. Under traditional IPv4 subnetting, the network and broadcast addresses are excluded, leaving 30 usable hosts.

This calculator follows the standard exceptions for /31 and /32. A /31 contains two addresses that can both be used on a point-to-point link under RFC 3021 behavior. A /32 represents one host route. Real routers, cloud platforms, and providers can apply additional reservations, so always compare the mathematical result with the platform you are configuring.

The wildcard mask is the bitwise inverse of the subnet mask. Every 255 becomes 0, every 0 becomes 255, and partial octets are inverted bit by bit. For example, 255.255.255.224 becomes 0.0.0.31. Wildcard masks are commonly used in access-control lists and routing configurations.

Common Uses for a Subnet Mask Calculator

  • Convert CIDR notation: Find the dotted mask required by a router, firewall, or older configuration screen.
  • Check an existing mask: Confirm that a dotted value is contiguous and identify its CIDR prefix.
  • Plan address capacity: Compare possible masks before assigning a network to users, servers, or devices.
  • Build access lists: Convert a subnet mask into the correct wildcard mask.
  • Find subnet boundaries: Use block size and an optional IP address to calculate the containing range.
  • Troubleshoot configurations: Compare the expected mask with the network and broadcast addresses produced by it.
  • Study networking: See how binary bits, dotted masks, CIDR prefixes, and host counts connect.

Understanding Your Results

  • Subnet Mask: The main dotted-decimal mask, such as 255.255.255.0.
  • CIDR Prefix: The number of leading network bits, written from /0 through /32.
  • Wildcard Mask: The inverse mask used by some access lists and routing systems.
  • Network Bits: The fixed leading bits that identify the subnet.
  • Host Bits: The remaining bits that vary inside the subnet.
  • Total Addresses: The complete mathematical capacity, including special endpoint addresses.
  • Usable Hosts: The traditional IPv4 host count, with /31 and /32 handled as special cases.
  • Changing Octet: The first mask octet that is not 255. It is commonly used when finding boundaries by hand.
  • Block Size: The distance between subnet boundaries in the changing octet. It is calculated as 256 minus that mask octet.
  • Binary Mask: All 32 mask bits divided into four groups for easier reading.
  • Hexadecimal Mask: The same 32 mask bits written as a hexadecimal value.
  • Integer Mask: The unsigned decimal number represented by all 32 mask bits.

When an IPv4 address is supplied, the calculator adds more fields. The network address is the first address in the block, and the broadcast address is the last address under IPv4 rules. First and last usable addresses show the traditional host range. Address position counts where the entered IP appears inside the complete block. Previous and next subnet fields show adjacent blocks with the same prefix.

Subnet Mask, Wildcard Mask, and CIDR Differences

A subnet mask and CIDR prefix express the same network boundary in different formats. The subnet mask uses four decimal octets, while CIDR uses a slash followed by the network-bit count. A wildcard mask reverses each mask bit, so its zeros indicate bits that must match and its ones indicate bits that may vary in systems that use wildcard matching.

Not every platform accepts every format. Many modern systems prefer CIDR, while some network interfaces request a dotted subnet mask. Router access lists may request a wildcard mask. Use the field requested by the platform instead of assuming the formats are interchangeable in its user interface.

Important Special Cases and Limitations

  • /0: Represents the entire IPv4 address space with mask 0.0.0.0.
  • /31: Contains two addresses commonly used for point-to-point links.
  • /32: Represents one individual IPv4 host route with mask 255.255.255.255.
  • Cloud reservations: A provider may reserve more addresses than traditional subnet rules.
  • No live configuration: The calculation does not change a router, firewall, server, or cloud network.
  • IPv4 only: IPv6 uses prefix lengths but does not use dotted-decimal subnet masks.

Frequently Asked Questions

What subnet mask is /24?

A /24 uses 255.255.255.0. It contains 256 total IPv4 addresses and traditionally provides 254 usable host addresses.

Can I convert a dotted mask back to CIDR?

Yes. Enter a contiguous dotted mask such as 255.255.255.192, and the calculator returns /26 with the related capacity details.

Why is 255.0.255.0 rejected?

Its binary ones are not contiguous. A valid subnet mask must contain all network ones first, followed by all host zeros.

Why are two addresses usually removed from the usable count?

Traditional IPv4 subnets reserve the first address as the network identifier and the last as the broadcast address. The /31 and /32 cases use different rules.

Do I have to enter an IPv4 address?

No. A mask alone is enough for conversion and capacity results. Add an address only when you also need its containing network boundaries.

Does this calculator support IPv6 masks?

No. IPv6 uses prefix notation rather than dotted subnet masks. Use the CIDR Notation Calculator for IPv6 ranges.

Related Tools and Calculators

Use the IPv4 Subnet Calculator when the address and prefix are both required from the start. Use the CIDR Notation Calculator for IPv4 or IPv6 CIDR ranges. You can also browse all published calculators or check a public address with the IP Lookup tool from ipdnslookup.