Binary explained simply

August 10, 2020

If you’re not yet fluent in binary, you’ve landed on the right article. Don’t worry; it’s easier than you think. Binary is about as simple as it can get. It’s either on or off. 1s and 0s. IP addresses and subnets are comprised of 32-bits each, divided into four 8-bit “octets.”

Binary table showing 4 8-bit octets


With the 8-bits in each octet, we can create any number between 0 and 255 (256 values). If we take a closer look at a single octet, we can see how each bit represents powers of 2, like so:

8-bit binary octet table explanation


This is where binary gets a little confusing for most people primarily because binary is a representation of numerical values for us—and it can be difficult for us humans to understand… but not the computer. The computer doesn’t think like this, and as far as the computer is concerned, there are only ever two numbers: 0 and 1. Binary is what we call “base-2.” If we read the above chart from right to left, we see that binary increases at a rate of 2 to the power of n-bits for every 0 we flip to 1. The first bit on the right, represented by the red 1 above has 2 valid states 0 or 1, or 2^1.

the power of 2 in binary


Now, if we include the next bit to the left, we come to 2^2, which gives us 4 valid states.

Binary table visualization of 4 valid states


This thought process is easier to conceptualize if we’re turning on bits from right to left in consecutive order. Subnet masks use this methodology to full extent and is their purpose. In order to generate numeric values for this octet, we don’t need to worry about anything but simple addition. We know that with 8 bits we can generate numbers anywhere between 0 and 255. As you can see in the charts above and below, each bit is represented by a numerical value: 128, 64, 32 and so on. If we add all of them together by flipping all the bits to 1, we arrive at the value 255 with a total of 256 values if we include 0 (which we do). To arrive at any value in between 0 and 255, we just “turn on” whatever bits add up to what we want. Let’s see what the number 192 looks like:

The number 192 in binary code


128 + 64 = 192. Simple. Looking at the IP address in binary now looks like this:

IP Address in binary code


128 + 64 =   192

128 + 32 + 8 = 168

32 + 8 + 4 = 44

8 + 4 + 1 =   13


Try converting a few IP addresses to binary.,,

Practice converting numbers to binary