First published on August 9, 2006
When I was learning the basics about computer networks, the Internet, etc., the concept of binary numbers was an essential building block in understanding concepts such as subnet masks and other nerdy stuff (admittedly, I don’t actually remember how subnet masks work, but that’s beside the point). IP addresses look something like this: 192.168.0.1 but are actually represented by a number such as this: 11000000.10101000.00000000.00000001.
How the heck do they come up with that? Well, each binary string in an IP address has 8 numbers, which we will call “slots”. Slots are read from right to left. A “1″ means that the slot is “open” or “on” and a “0″ means that the slot is “closed” or “off”. 11111111 means that every slot is open. From right to left, the first slot’s value is 1, and each successive slot’s value is double the previous one (128, 64, 32, 16, 8, 4, 2, 1). To calculate the value of binary string, add up each open slot’s value.
00001100 represents the number 12. Why? The third slot (from the right) is open (because it has a 1) and has a value of 4. The fourth slot is open and has a value of 8. By adding up the value of all open slots, you arrive at 12.
Using only 0′s and 1′s, a set of 8 slots can represent every number between 0 and 255. Each number in an IP address can only be between 0 and 255.
Here’s a calculator to check whether you know how to convert normal IP addresses to binary numbers.