Subnetmask Calculator

Subnetmask Calculator

The subnet mask is the translator between an IP address and its network: a string of one-bits that marks which part of the address is the network and which part is the host. Whether you write it as /26, 255.255.255.192, or a row of binary digits, it is the same value in three costumes. The subnetmask calculator above converts any CIDR prefix into all three forms, plus the wildcard mask and the host counts, so you always have the exact notation your router, firewall, or documentation demands.

How to Use the Subnetmask Calculator

  1. Enter the CIDR prefix. Type a number from 0 to 32, such as 26.
  2. Press Calculate. The tool converts the prefix into every mask notation at once.
  3. Read the subnet mask. This dotted-decimal form (e.g. 255.255.255.192) goes into interface and DHCP configuration.
  4. Check the binary mask. Useful when you are learning subnetting or verifying a tricky boundary by hand.
  5. Copy the wildcard mask. Use this inverse form in access-control lists and OSPF network statements.
  6. Press Reset to convert another prefix.

Worked Example

Enter 26 into the calculator:

  • Subnet mask: 255.255.255.192
  • Binary mask: 11111111.11111111.11111111.11000000
  • Wildcard mask: 0.0.0.63
  • Total addresses: 64
  • Usable hosts: 62

The binary row shows why: 26 one-bits mark the network portion, and the 6 remaining zero-bits give 2^6 = 64 addresses.

Try a /20:

  • Subnet mask: 255.255.240.0
  • Binary mask: 11111111.11111111.11110000.00000000
  • Wildcard mask: 0.0.15.255
  • Total addresses: 4,096
  • Usable hosts: 4,094

Enter 20 and confirm the same output. The 240 in the third octet comes from 4 one-bits there (128+64+32+16 = 240).

More Helpful Information

How prefixes become masks. A /n prefix means n one-bits followed by (32−n) zero-bits, grouped into four octets. Each octet's decimal value is the sum of its set bit weights (128, 64, 32, 16, 8, 4, 2, 1). For /26, the last octet has bits 128+64 set, giving 192.

Octet values cheat sheet. 8 bits → 255, 7 bits → 254, 6 bits → 252, 5 bits → 248, 4 bits → 240, 3 bits → 224, 2 bits → 192, 1 bit → 128, 0 bits → 0. Every valid mask octet is one of these nine values — if you ever see anything else, the mask is invalid.

Wildcard masks. The wildcard is the mask's inverse: subtract each octet from 255. So 255.255.255.192 becomes 0.0.0.63. Cisco ACLs and OSPF use this form, which is why both appear side by side in the results.

Contiguous masks. Valid subnet masks always have all one-bits before all zero-bits. A mask like 255.0.255.0 is invalid and will be rejected by every router — the calculator only ever produces valid contiguous masks.

Memorizing the big ones. You will use /24, /16, and /8 constantly, so commit their masks to memory: /24 is 255.255.255.0, /16 is 255.255.0.0, and /8 is 255.0.0.0. From there, learn the /25 through /30 sequence for the last octet — 128, 192, 224, 240, 248, 252 — because it covers nearly every office, branch, and point-to-point subnet you will ever build.

When each form is used. Dotted decimal in server and router interfaces; CIDR in documentation and cloud consoles; binary when learning or debugging; wildcard in ACLs. Keep this calculator bookmarked and you will never convert by hand again.

Frequently Asked Questions

1. What is the subnet mask for /26?

255.255.255.192, which is 11111111.11111111.11111111.11000000 in binary.

2. How do I convert CIDR to a subnet mask?

Write n one-bits followed by (32−n) zero-bits, split into four octets, and convert each octet to decimal.

3. What is the subnet mask for /24?

255.255.255.0 — the most common mask for small networks.

4. What is a wildcard mask?

The inverse of the subnet mask. For /24 it is 0.0.0.255; it is used in access-control lists.

5. What is the subnet mask for /16?

255.255.0.0, giving 65,534 usable hosts.

6. What does 255.255.255.192 mean?

It is a /26 mask: the first 26 bits identify the network, leaving 6 host bits (64 addresses, 62 usable).

7. Can a subnet mask be non-contiguous?

No. Valid masks have all one-bits first, then all zero-bits. Non-contiguous masks are rejected by networking equipment.

8. What is the binary mask for /20?

11111111.11111111.11110000.00000000.

9. What wildcard goes with 255.255.240.0?

0.0.15.255 — each octet subtracted from 255.

10. How many hosts does 255.255.255.224 support?

That is a /27: 32 total addresses, 30 usable hosts.

11. Is /0 a valid prefix?

Yes. It is mask 0.0.0.0, the default route — it matches every address.

12. What is the mask for a single host?

/32, written 255.255.255.255 — a host route.

13. Why do I need the binary form?

It makes the network/host split visible, which helps when you are learning subnetting or checking unusual boundaries like /20 or /27.

14. What is the difference between a subnet mask and an IP address?

An IP address identifies a device; the mask identifies which portion of the address is the network. They are always used together.

15. How many usable hosts come with 255.255.255.0?

254 usable hosts out of 256 total addresses.

CONCLUSION

A subnet mask is one value in four notations, and this calculator gives you all of them — dotted decimal, binary, wildcard, and CIDR — plus the address and host counts for any prefix from /0 to /32. Use it whenever you configure interfaces, write access lists, or document a network, and you will always have the right notation on hand. Remember the nine valid octet values, keep masks contiguous, and match the notation to the device you are configuring.