To truly understand subnets it’s far easier to understand them from the perspective of the computer. Most people will be used to seeing a subnet written as, for example, 255.255.255.0, but decimal octets are purely for the readability of human eyes. Computers work with subnets on a binary level, and where a human sees 255.255.255.0, a computer sees 11111111111111111111111100000000.
So how does a subnet translate to network division? Well, every IP address has a network portion and a host portion, such as 192.168.2.128. In this example — if a subnet of 255.255.255.0 is used — 192.168.2 is the network and 128 is the host. The first question a computer asks itself is, “is the device I’m sending data to on the same network as me?”, and then proceeds to compare the destination IP address against its own IP address. If 192.168.2.128 is sending data to 192.168.2.206, then it can see by comparing it to the subnet 255.255.255.0 that they are both on the same network, and therefore the data only needs to be sent via the local network.
All of the 1′s in a subnet represent the network, and all of the 0′s represent the host; the computer aligns the subnet with the IP address to determine which numbers represent the network and which represents the host: