---
description: Subnetting is the practice of dividing a network into two or smaller networks. It increases routing efficiency, which helps to enhance the security of the network and reduces the size of the broadcast domain.
title: Subnet Mask &#038; Subnetting: What is it?
image: https://www.guru99.com/images/subnet-mask-and-subnetting.png
---

 

[Skip to content](#main) 

**⚡ Smart Summary**

Subnetting divides a large network into smaller logical segments, improving routing efficiency, conserving scarce IPv4 addresses, and tightening security. A subnet mask, a 32-bit value, marks which bits identify the network and which identify the host.

* 🌐 **Network Division:** Subnetting splits one network into smaller, manageable broadcast domains.
* 🎯 **Subnet Mask:** A 32-bit mask separates the network portion from the host portion.
* 🧮 **CIDR Notation:** A /24 prefix marks 24 network bits, leaving 8 for hosts.
* ➗ **Host Formula:** Usable hosts equal two raised to the host bits, minus two.
* 🔐 **Security:** Segmenting traffic isolates teams and limits broadcast exposure.
* 🤖 **AI Planning:** AI tools size subnets and generate masks from host requirements.

[ Read More ](javascript:void%280%29;) 

![Subnetting and Subnet Mask](https://www.guru99.com/images/subnet-mask-and-subnetting.png)

## What is Subnetting?

**Subnetting** is the practice of dividing a network into two or more smaller networks. It increases routing efficiency, helps to enhance the security of the network, and reduces the size of the broadcast domain.

IP subnetting designates high-order bits from the host as part of the network prefix. This method divides a network into smaller subnets. It also helps you reduce the size of the routing tables stored in routers, extend the existing IP address base, and restructure the IP address.

## Why Use Subnetting?

Here are important reasons for using subnetting:

* It helps you to maximize IP addressing efficiency.
* It extends the life of IPv4, whose public addresses are scarce.
* IPv4 subnetting reduces network traffic by eliminating collision and broadcast traffic, which improves overall performance.
* This method allows you to apply network security policies at the interconnection between subnets.
* It optimizes IP network performance and facilitates spanning of large geographical distances.
* The subnetting process helps to allocate IP addresses so that large numbers of IP network addresses do not remain unused.
* Subnets are usually set up geographically for specific offices or particular teams within a business, which allows their network traffic to stay within the location.

## What is Subnet Mask?

A subnet mask is a 32-bit address used to distinguish between a network address and a host address in an [IP address](https://www.guru99.com/types-of-ip-addresses.html). A subnet mask identifies which part of an IP address is the network address and which part is the host address. Subnet masks are not shown inside the data packets traversing the Internet; the packets carry the destination IP address, which a router matches with a subnet.

[](https://www.guru99.com/images/2/110620%5F0800%5FSubnettingW1.png)

_1 represents the network, 0 represents the hosts_

Two types of subnet masks are:

* The **default subnet mask** is the number of bits reserved by the address class. Using this default mask accommodates a single network subnet in the relative class.
* A **custom subnet mask** can be defined by an administrator to accommodate many networks.

### RELATED ARTICLES

* [How to Find & Change MAC Address in Mac OS ](https://www.guru99.com/mac-address-find-change.html "How to Find & Change MAC Address in Mac OS")
* [VLAN Trunking Protocol: What is VTP in Networking ](https://www.guru99.com/vlan-trunking-protocol.html "VLAN Trunking Protocol: What is VTP in Networking")
* [12 BEST System Monitoring Software Tools (2026) ](https://www.guru99.com/best-system-monitoring-software.html "12 BEST System Monitoring Software Tools (2026)")
* [Top 50 Nginx Interview Questions and Answers (2026) ](https://www.guru99.com/nginx-interview-questions.html "Top 50 Nginx Interview Questions and Answers (2026)")

## How to Use a Subnet Mask?

The subnet mask is used by the router to cover up the network address. It shows which bits are used to identify the subnet.

Every network has its own unique address. For example, a Class B network has the network address 172.20.0.0, which has all zeroes in the host portion of the address.

Example IP address: 11000001\. Here the 1st and 2nd bits are 1 and the 3rd bit is 0; hence, it belongs to Class C.

[](https://www.guru99.com/images/2/110620%5F0800%5FSubnettingW2.png)

_How to identify which class the IP address belongs to_

The example above shows how IP addresses should be deconstructed, which makes it simple for Internet routers to find the right network to route data into. However, in a Class A network there could be millions of connected devices, and it could take some time for the router to find the right device.

## Methods of Subnet Masking

We can perform the subnet masking process in two ways: Straight or Short-cut.

**1) Straight**

You should use the binary notation method for both the address and the mask, and then apply the AND operation to get the block address.

**2) Short-Cut Method**

* When the byte in the mask is 255, copy the byte in the destination address.
* When the byte in the mask is 0, replace the byte in the address with 0.
* When the byte in the mask is neither 255 nor 0, write the mask and the address in binary and use the AND operation.
* If the extracted network address matches the local network ID, the destination is located on the local network. If they do not match, the message must be routed outside the local network.

| Class | Default subnet mask | No. of networks | No. of hosts per network |
| ----- | ------------------- | --------------- | ------------------------ |
| A     | 255.0.0.0           | 128             | 16,777,214               |
| B     | 255.255.0.0         | 16,384          | 65,534                   |
| C     | 255.255.255.0       | 2,097,152       | 254                      |

## Important Formulas to Determine the Subnets

Use the **2s − 2** formula, and do not use the zero and broadcast ranges, if:

* You use the classful routing method.
* RIP version 1 is used.
* The _no ip subnet-zero_ command is configured on your router.

Use the **2s** formula and use the zero and broadcast ranges if:

* You use a classless routing or VLSM method.
* RIP version 2, EIGRP, or OSPF is used.
* The _ip subnet-zero_ command is configured on your router.

## FAQs

⚡ What is CIDR notation in subnetting?

CIDR (Classless Inter-Domain Routing) writes a subnet mask as a slash and a number, such as /24\. The number counts the network bits, so /24 leaves 8 bits for hosts.

🧮 How do you calculate the number of hosts in a subnet?

Use the formula 2^(32 − prefix) − 2\. The minus two removes the network address and the broadcast address. A /26 subnet therefore allows 2^6 − 2 = 62 usable hosts.

➗ How many subnets do you get by borrowing bits?

Borrowing n bits from the host portion creates 2^n subnets. Borrowing 2 bits makes 4 subnets, so splitting 192.168.1.0/24 into four equal blocks changes the prefix from /24 to /26.

🔢 Default vs custom subnet mask, what is the difference?

A default mask matches the address class, such as 255.255.255.0 for Class C. A custom mask borrows extra host bits, letting an administrator carve one classful network into many smaller subnets.

📡 Why are two addresses reserved in every subnet?

The first address identifies the subnet itself, and the last address is the broadcast address. Because neither can be assigned to a device, the usable-host count always subtracts these two.

🆚 What is VLSM and how does it differ from fixed subnetting?

VLSM (Variable Length Subnet Masking) assigns different mask lengths to different subnets, sizing each block to its actual host need. Fixed subnetting uses one mask everywhere, which wastes addresses.

🤖 Can AI tools help design a subnet plan?

Yes. AI assistants and machine learning planners take a host count per site and suggest prefixes, masks, and address ranges, then explain each choice, reducing manual binary math and errors.

🛡️ How does AI strengthen subnet security?

Intelligent monitoring tools learn normal traffic per subnet and flag anomalies that cross segment boundaries. They automate firewall rule suggestions, helping teams contain threats inside isolated subnets.

#### Summarize this post with:

ChatGPT Perplexity Grok Google AI 

**Stay Updated on AI** **Get Weekly AI Skills, Trends, Actionable Advice.** 

##### Sign up for the newsletter

Subscribe for Free 

You have successfully subscribed.  
Please check your inbox. 

![AI-Newsletter]() Chosen by over **350,000+** professionals 

[Scroll to top ](#wrapper)Scroll to top 

× 

Toggle Menu Close 

Search for: 

Search

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.guru99.com/#organization","name":"Guru99","sameAs":["https://www.facebook.com/Guru99Official","https://twitter.com/guru99com"],"logo":{"@type":"ImageObject","@id":"https://www.guru99.com/#logo","url":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","contentUrl":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","caption":"Guru99","inLanguage":"en-US"}},{"@type":"WebSite","@id":"https://www.guru99.com/#website","url":"https://www.guru99.com","name":"Guru99","publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https://www.guru99.com/images/subnet-mask-and-subnetting.png","url":"https://www.guru99.com/images/subnet-mask-and-subnetting.png","width":"700","height":"250","caption":"Subnet Mask &amp; Subnetting","inLanguage":"en-US"},{"@type":"BreadcrumbList","@id":"https://www.guru99.com/subnetting-subnet-mask.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":"1","item":{"@id":"https://www.guru99.com","name":"Home"}},{"@type":"ListItem","position":"2","item":{"@id":"https://www.guru99.com/networking","name":"Networking"}},{"@type":"ListItem","position":"3","item":{"@id":"https://www.guru99.com/subnetting-subnet-mask.html","name":"Subnet Mask &#038; Subnetting: What is it?"}}]},{"@type":"WebPage","@id":"https://www.guru99.com/subnetting-subnet-mask.html#webpage","url":"https://www.guru99.com/subnetting-subnet-mask.html","name":"Subnet Mask &#038; Subnetting: What is it?","dateModified":"2026-06-30T12:37:22+05:30","isPartOf":{"@id":"https://www.guru99.com/#website"},"primaryImageOfPage":{"@id":"https://www.guru99.com/images/subnet-mask-and-subnetting.png"},"inLanguage":"en-US","breadcrumb":{"@id":"https://www.guru99.com/subnetting-subnet-mask.html#breadcrumb"}},{"@type":"Person","@id":"https://www.guru99.com/author/bryce","name":"Bryce Leo","description":"I'm Bryce Leo, an IT Specialist with expertise in network administration and cybersecurity, committed to enhancing IT infrastructure.","url":"https://www.guru99.com/author/bryce","image":{"@type":"ImageObject","@id":"https://www.guru99.com/images/bryce-leo-author.png","url":"https://www.guru99.com/images/bryce-leo-author.png","caption":"Bryce Leo","inLanguage":"en-US"},"worksFor":{"@id":"https://www.guru99.com/#organization"}},{"articleSection":"Networking","headline":"Subnet Mask &#038; Subnetting: What is it?","description":"Subnetting is the practice of dividing a network into two or smaller networks. It increases routing efficiency, which helps to enhance the security of the network and reduces the size of the broadcast domain.","keywords":"network, hacking","speakable":{"@type":"SpeakableSpecification","cssSelector":[".entry-title",".summary"]},"@type":"Article","author":{"@id":"https://www.guru99.com/author/bryce","name":"Bryce Leo"},"dateModified":"2026-06-30T12:37:22+05:30","image":{"@id":"https://www.guru99.com/images/subnet-mask-and-subnetting.png"},"copyrightYear":"2026","name":"Subnet Mask &#038; Subnetting: What is it?","subjectOf":[{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is CIDR notation in subnetting?","acceptedAnswer":{"@type":"Answer","text":"CIDR (Classless Inter-Domain Routing) writes a subnet mask as a slash and a number, such as /24. The number counts the network bits, so /24 leaves 8 bits for hosts."}},{"@type":"Question","name":"How do you calculate the number of hosts in a subnet?","acceptedAnswer":{"@type":"Answer","text":"Use the formula 2^(32 - prefix) - 2. The minus two removes the network address and the broadcast address. A /26 subnet therefore allows 2^6 - 2 = 62 usable hosts."}},{"@type":"Question","name":"How many subnets do you get by borrowing bits?","acceptedAnswer":{"@type":"Answer","text":"Borrowing n bits from the host portion creates 2^n subnets. Borrowing 2 bits makes 4 subnets, so splitting 192.168.1.0/24 into four equal blocks changes the prefix from /24 to /26."}},{"@type":"Question","name":"Default vs custom subnet mask, what is the difference?","acceptedAnswer":{"@type":"Answer","text":"A default mask matches the address class, such as 255.255.255.0 for Class C. A custom mask borrows extra host bits, letting an administrator carve one classful network into many smaller subnets."}},{"@type":"Question","name":"Why are two addresses reserved in every subnet?","acceptedAnswer":{"@type":"Answer","text":"The first address identifies the subnet itself, and the last address is the broadcast address. Because neither can be assigned to a device, the usable-host count always subtracts these two."}},{"@type":"Question","name":"What is VLSM and how does it differ from fixed subnetting?","acceptedAnswer":{"@type":"Answer","text":"VLSM (Variable Length Subnet Masking) assigns different mask lengths to different subnets, sizing each block to its actual host need. Fixed subnetting uses one mask everywhere, which wastes addresses."}},{"@type":"Question","name":"Can AI tools help design a subnet plan?","acceptedAnswer":{"@type":"Answer","text":"Yes. AI assistants and machine learning planners take a host count per site and suggest prefixes, masks, and address ranges, then explain each choice, reducing manual binary math and errors."}},{"@type":"Question","name":"How does AI strengthen subnet security?","acceptedAnswer":{"@type":"Answer","text":"Intelligent monitoring tools learn normal traffic per subnet and flag anomalies that cross segment boundaries. They automate firewall rule suggestions, helping teams contain threats inside isolated subnets."}}]}],"@id":"https://www.guru99.com/subnetting-subnet-mask.html#schema-1126292","isPartOf":{"@id":"https://www.guru99.com/subnetting-subnet-mask.html#webpage"},"publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US","mainEntityOfPage":{"@id":"https://www.guru99.com/subnetting-subnet-mask.html#webpage"}}]}
```
