How To Subnet
In this tutorial, you will learn how to subnet a network in an easy way for beginners. Subnetting is designed for devices that are connected to a network and have to perform this operation repeatedly and quickly. Computers, routers, and smartphones operate in a binary world, reading, transmitting, and processing data with a binary representation.

A host that sends packets on the wire is sending sets of signals that translate to binary data. Each binary digit is called a bit because a signal translates to 1 and a loss of signal translates to 0. In contrast to machines, humans use the decimal numbering system (not hackers and ninjas who use HEX all day, but all other humans) that uses ten digits 0-9 to represent any number.
IPv4 addresses are written as four decimal numbers separated by periods (e.g., 192.168.0.1). Each octet value can be between 0 and 255. Therefore, we need to learn how to convert a decimal number to a binary number. We can convert any number between 0-255 to 8 bits, also called a byte.
Decimal to Binary Conversion
Every bit in a byte has a different value, and the value doubles from right to left as it moves across the byte.
| Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|
| Bit | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
For example, we will translate the number 125 to 8 binary bits. The algorithm is to start from the left and check if the number is equal to or greater than the value. If it is, we subtract the value and mark the bit as 1. Otherwise, we mark the bit as 0.
- 125 is not >= 128 (Bit 128 = 0)
- 125 is >= 64 (125 - 64 = 61) (Bit 64 = 1)
- 61 is >= 32 (61 - 32 = 29) (Bit 32 = 1)
- 29 is >= 16 (29 - 16 = 13) (Bit 16 = 1)
- 13 is >= 8 (13 - 8 = 5) (Bit 8 = 1)
- 5 is >= 4 (5 - 4 = 1) (Bit 4 = 1)
- 1 is not >= 2 (Bit 2 = 0)
- 1 is >= 1 (1 - 1 = 0) (Bit 1 = 1)
The binary representation of 125 is 01111101.
The AND Gate
Another elementary building block of computing devices is the logical gate. For subnetting, we use the AND gate. It takes two binary numbers as input and outputs one bit by the following rule: If both bits are 1, the output is 1. Otherwise, the output is 0.
By applying the AND gate between an IP Address and a Subnet Mask, we can quickly determine the Network Address!
| IP Address (192.168.0.100) | Subnet mask (255.255.255.224) | Network Address Result |
|---|---|---|
| 11000000.10101000.00000000.01100100 | 11111111.11111111.11111111.11100000 | 11000000.10101000.00000000.01100000 |
Translating the binary result back to decimal gives us 192.168.0.96.
Quick Ninja Tip: Because the first three octets of the subnet mask above are 255 (or 11111111), the Network address is identical to the IP address in those first three octets. You only need to translate the final octet! Go ahead and practice, then check your results with our Subnet Calculator Ninja.