How to count in Binary

How to count in Binary

Understanding binary counting is fundamental for network engineers working with IP addressing, subnetting, and digital systems. Binary uses only two digits (0 and 1) instead of the ten digits (0-9) we use in decimal.

Binary Place Values

In decimal, each position represents a power of 10. In binary, each position represents a power of 2:

Position:  7    6    5    4    3    2    1    0
Power:     2^7  2^6  2^5  2^4  2^3  2^2  2^1  2^0
Value:     128  64   32   16   8    4    2    1

Counting in Binary

Binary counting follows a simple pattern. Starting from 0, you increment the rightmost bit. When a bit reaches 1 and needs to increment again, it becomes 0 and carries over to the next position:

Decimal  Binary   Explanation
0        0000     All bits are 0
1        0001     Rightmost bit becomes 1
2        0010     Bit 1 carries over, bit 0 becomes 0
3        0011     Bit 0 becomes 1 again
4        0100     Bit 2 carries over, bits 1 and 0 become 0
5        0101     Bit 0 becomes 1
6        0110     Bit 1 becomes 1
7        0111     Bit 0 becomes 1
8        1000     Bit 3 carries over, all lower bits become 0

Converting Binary to Decimal

To convert binary to decimal, multiply each bit by its place value and add the results:

Example: Convert 10110101 to decimal

Position: 7  6  5  4  3  2  1  0
Binary:   1  0  1  1  0  1  0  1
Value:    128 0  32 16 0  4  0  1

Calculation: 128 + 0 + 32 + 16 + 0 + 4 + 0 + 1 = 181

Converting Decimal to Binary

To convert decimal to binary, repeatedly divide by 2 and track the remainders:

Example: Convert 181 to binary

181 ÷ 2 = 90 remainder 1
90 ÷ 2 = 45 remainder 0
45 ÷ 2 = 22 remainder 1
22 ÷ 2 = 11 remainder 0
11 ÷ 2 = 5 remainder 1
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1

Reading remainders from bottom to top: 10110101

Practical Application in Networking

Binary counting is essential for understanding:

  • IP addressing: IPv4 addresses are 32-bit binary numbers displayed in dotted decimal notation
  • Subnet masks: Determine network and host portions of IP addresses
  • VLSM calculations: Variable Length Subnet Masking requires binary arithmetic
  • Access control lists: Wildcard masks use binary operations for matching

Quick Reference

Here are the first 16 binary numbers for quick reference:

0 = 0000    8 = 1000
1 = 0001    9 = 1001
2 = 0010    10 = 1010
3 = 0011    11 = 1011
4 = 0100    12 = 1100
5 = 0101    13 = 1101
6 = 0110    14 = 1110
7 = 0111    15 = 1111

Practice converting between binary and decimal regularly to build fluency. This skill becomes automatic with repetition and forms the foundation for more advanced networking concepts like subnetting and CIDR notation.