Updated on December 13, 2022 | Read time ~ 3 mins
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.”
What is Binary Code?
Binary code is a type of code used by computers in which two numbers, 0 and 1, represent two possible states, on and off. Let's breakdown what that really means with an example. The smallest unit of code that a computer can process is called a "bit." Here's a sample of 4 snippets of binary code, with 8-bits in each snippet, which we call "octets." Though you don't recognize it yet, this is a starting point for the binary code we might see behind an IP address:
With the 8-bits in each octet, we can create any number between 0 and 255 (256 values). Now, let's look at that same sequence, but with larger values. If we take a closer look at a single octet, we can see how each bit represents powers of 2, like so:
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.
Now, if we include the next bit to the left, we come to 2^2, which gives us 4 valid states.
How do you write something in binary code?
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:
128 + 64 = 192. Simple. Looking at the IP address 192.168.44.13 in binary now looks like this:
128 + 64 = 192
128 + 32 + 8 = 168
32 + 8 + 4 = 44
8 + 4 + 1 = 13
Try converting a few IP addresses to binary:
5 keys to successful organizational design
How do you create an organization that is nimble, flexible and takes a fresh view of team structure? These are the keys to creating and maintaining a successful business that will last the test of time.Read more
8 ways to stand out in your stand-up meetings
Whether you call them stand-ups, scrums, or morning circles, here's some secrets to standing out and helping everyone get the most out of them.Read more
Technology in 2025: Prepare your workforce
The key to surviving this new industrial revolution is leading it. That requires two key elements of agile businesses: awareness of disruptive technology and a plan to develop talent that can make the most of it.Read more