Perform the binary AND operation on the following two numbers:

00000100

11111110

This is the same technique you would use to find a Network ID. Have your answer include all 8 bits (including leading zeros when needed).

You can verify your answers with our Binary Decimal Hexadecimal Calculator.

Binary is the key to subnetting. All computers process data in binary. A circuit is either on or off. Learning to count in binary, and also to translate binary into decimal will help not only with subnetting but also with understanding computers in general.

Let’s review counting in decimal first as that’s how us humans are used to dealing with numbers… each column in a decimal number has **10** possible values from 0-9. Every time a column is added to the left, the value is multiplied by **10**. We start with ‘1s’ as the furthest right column, then ’10s’ in the next column to the left, then ‘100s’ in the next column to the left etc.

Eight hundred and sixty five is written in decimal as ‘865’. That’s 8 100’s, 6 10’s, and 5 1’s.

Computers work in binary. Electrical impulses are either off or on, so there’s only two choices (0 or 1), unlike the ten we have in decimal (0-9).

For each column in a number written in binary there are **2** possible choices, 0 or 1.

Every time a column is added to the left, the value is multiplied by **2**.

For the column furthest to the right, the value is 0 or 1.

This is how we write zero in binary: 0

And this is how we write one in binary: 1

That’s the same as decimal so far. But because binary uses a 0 or 1 in each column, to count above one we need to add another column to the left.

This is how we write two in binary: 10

And this is how we write three in binary: 11

What do you think four is in binary? Well, we already used up all combinations of two digits to get to the value of three. We used 00, 01, 10, 11. So we need to move to the next digit. Four is written 100 in binary.

In subnetting we sometimes have to deal with large numbers. Numbers such as 234 or 192. Luckily we don’t have to count one by one to find these numbers in binary. The real trick is to remember that every digit represents an exponent of two.

If there is a ‘1’ value in the right-hand most digit, then you add 2^{0} (that’s 1) to the total value of the number. If there is a ‘1’ value in the second to right digit then you add 2^{1} (that’s 2) to the total value, and if there is a ‘1’ value in the third to right digit then you add 2^{2} (that’s 4) to the value etc. If there is a ‘0’ value in any digit then it is not added to the total value of the number.

This makes more sense when you see it written in the table below. The 1st column furthest to the right represents 1s, then the next column to the left represents 2s, then we double that for the next column to the left representing 4s, then we double that again for the next column to the left representing 8s etc:

Bit | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |

Bit Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

Power of two | 2^{7} | 2^{6} | 2^{5} | 2^{4} | 2^{3} | 2^{2} | 2^{1} | 2^{0} |

Lets take an example. What is the decimal equivalent of binary 100101? Look at the digits that have a 1 value:

**1**00**1**0**1**

Working from right to left, we have:

2^{0} = 1

2^{2} = 4

2^{5} = 32

We add these together, 32 + 4 + 1 = 37.

37 is the decimal value of 100101!

It’s a good idea to do some exponent practice to master your powers of two.

You can also count in hexadecimal. This is the same idea as binary, but in base 16, so a single digit has a value of zero to fifteen.

Hexadecimal digit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |

Decimal Value | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

Being able to convert between hex, decimal and binary is helpful to network engineers for subnetting and because IPv6 addresses are displayed using hexadecimal digits.

Download our **Subnet Cheat Sheet** for all the essential information you need to quickly perform subnet calculations in your head.

If you want to learn more about networking and get the Cisco CCNA certification, we highly recommend the Cisco CCNA Gold Bootcamp as your **CCNA training course**. The CCNA is by far the most in-demand networking certification by employers, and the Gold Bootcamp is the highest rated Cisco course online. It has an average rating of 4.8 from over 30,000 public reviews: