Binary (Base2 )

Why learn the Binary (Base2 ) number system?

While humans use the decimal number system based on the ten digits or fingers of the hands, computer systems use the binary number system based on the two states of on/off switches. These two states, off (0) and on (1), provide the foundation for understanding how computer systems and networks work.

Binary
Digit
Value
Switch
State
0 off
1 on

A binary digit is called a bit (from the combined abbreviation of binary digit). Bits can have the value of off (0) or on (1). Although bits are the smallest storage unit in a computer system, most storage on computer systems is referenced by an eight bit unit called a byte. Here are some ways in which bits and bytes are referenced in computer and network systems:

Reference Measure Example
Throughput
or Bandwidth
bits per second (bps) 56Kbps Modem
100Mbps Ethernet
bytes per second (Bps) 80 MBps Ultra2 SCSI
Communication
Synchronization
data bits
parity bits
stop bits
Modem Settings
(8, none and 1)
Video
Resolution
bits per pixel 24-bit True Color
Audio
Resolution
bits per sample 16-bit Sound Card
Operating
System
Addressing
bits per address 16-bit Application
32-bit Application
Disk
Format
bits per address FAT-16
FAT-32
Network
Addressing
bits per address 32-bit IPv4 Address
128-bit IPv6 Address
Bus/Data
Paths
parallel paths 16-bit Bus
32-bit Bus
Character
Codes
bits per character 7-bit ASCII
8-bit Extended ASCII
Storage
Capacity
bytes 512 MB RAM
60 GB Hard Drive
Software
Configuration
bit settings Cisco IOS Configuration Register
Linux File Permissions
File Archive Bit

What is the Binary (Base2 ) number system?

The binary base2 number system consists of two elements:

  1. Only two digits are used in the number system (i.e., 0 and 1).
  2. Each column represents a value based on a factor of 2.
Digits 1st Four Columns

Column Conversion to Decimal

0-1 or 23 22 21 20

Binary 10102 converted to Decimal equals
 (1x8)+(0x4)+(1x2)+(0x1) = 10

8 4 2 1

How does the Binary (Base2 ) number system work?

Counting in Binary (Base2)

The standard unit of storage in computing is a byte. A byte consists of 8 bits. A byte can contain the decimal values 0-255 for a total of 256 different numbers or bit combinations. Below is a table that counts through all the possible bit combinations in a byte (decimal values 0-255).

Decimal
Base10
Binary
Base2
Decimal
Base10
Binary
Base2
Decimal
Base10
Binary
Base2
Decimal
Base10
Binary
Base2
0 00000000 64 01000000 128 10000000 192 11000000
1 00000001 65 01000001 129 10000001 193 11000001
2 00000010 66 01000010 130 10000010 194 11000010
3 00000011 67 01000011 131 10000011 195 11000011
4 00000100 68 01000100 132 10000100 196 11000100
5 00000101 69 01000101 133 10000101 197 11000101
6 00000110 70 01000110 134 10000110 198 11000110
7 00000111 71 01000111 135 10000111 199 11000111
8 00001000 72 01001000 136 10001000 200 11001000
9 00001001 73 01001001 137 10001001 201 11001001
10 00001010 74 01001010 138 10001010 202 11001010
11 00001011 75 01001011 139 10001011 203 11001011
12 00001100 76 01001100 140 10001100 204 11001100
13 00001101 77 01001101 141 10001101 205 11001101
14 00001110 78 01001110 142 10001110 206 11001110
15 00001111 79 01001111 143 10001111 207 11001111
16 00010000 80 01010000 144 10010000 208 11010000
17 00010001 81 01010001 145 10010001 209 11010001
18 00010010 82 01010010 146 10010010 210 11010010
19 00010011 83 01010011 147 10010011 211 11010011
20 00010100 84 01010100 148 10010100 212 11010100
21 00010101 85 01010101 149 10010101 213 11010101
22 00010110 86 01010110 150 10010110 214 11010110
23 00010111 87 01010111 151 10010111 215 11010111
24 00011000 88 01011000 152 10011000 216 11011000
25 00011001 89 01011001 153 10011001 217 11011001
26 00011010 90 01011010 154 10011010 218 11011010
27 00011011 91 01011011 155 10011011 219 11011011
28 00011100 92 01011100 156 10011100 220 11011100
29 00011101 93 01011101 157 10011101 221 11011101
30 00011110 94 01011110 158 10011110 222 11011110
31 00011111 95 01011111 159 10011111 223 11011111
32 00100000 96 01100000 160 10100000 224 11100000
33 00100001 97 01100001 161 10100001 225 11100001
34 00100010 98 01100010 162 10100010 226 11100010
35 00100011 99 01100011 163 10100011 227 11100011
36 00100100 100 01100100 164 10100100 228 11100100
37 00100101 101 01100101 165 10100101 229 11100101
38 00100110 102 01100110 166 10100110 230 11100110
39 00100111 103 01100111 167 10100111 231 11100111
40 00101000 104 01101000 168 10101000 232 11101000
41 00101001 105 01101001 169 10101001 233 11101001
42 00101010 106 01101010 170 10101010 234 11101010
43 00101011 107 01101011 171 10101011 235 11101011
44 00101100 108 01101100 172 10101100 236 11101100
45 00101101 109 01101101 173 10101101 237 11101101
46 00101110 110 01101110 174 10101110 238 11101110
47 00101111 111 01101111 175 10101111 239 11101111
48 00110000 112 01110000 176 10110000 240 11110000
49 00110001 113 01110001 177 10110001 241 11110001
50 00110010 114 01110010 178 10110010 242 11110010
51 00110011 115 01110011 179 10110011 243 11110011
52 00110100 116 01110100 180 10110100 244 11110100
53 00110101 117 01110101 181 10110101 245 11110101
54 00110110 118 01110110 182 10110110 246 11110110
55 00110111 119 01110111 183 10110111 247 11110111
56 00111000 120 01111000 184 10111000 248 11111000
57 00111001 121 01111001 185 10111001 249 11111001
58 00111010 122 01111010 186 10111010 250 11111010
59 00111011 123 01111011 187 10111011 251 11111011
60 00111100 124 01111100 188 10111100 252 11111100
61 00111101 125 01111101 189 10111101 253 11111101
62 00111110 126 01111110 190 10111110 254 11111110
63 00111111 127 01111111 191 10111111 255 11111111

*To count in binary using your fingers, try this web page.

Column Values in Binary (Base2)
For the base2 binary number system, the 1st eight columns look like the following (note that these eight columns also represent eight bits or one byte):

Power 27 26 25 24 23 22 21 20
Value 128 64 32 16 8 4 2 1
Column 8th 7th 6th 5th 4th 3rd 2nd 1st

For the value of the 1st column, the base is raised to the power of zero (i.e., 20). To get the next column value, one is added to the power of the current column (i.e., 21 for the 2nd column, 22 for the 3rd column, etc.). Powers or exponents simply determine how many times the number should be multiplied by itself (note that the powers of zero and one are an exception).

20 = 1, any number raised to the power of zero is 1
21 = 2, any number raised to the power of one is the number itself
22 = 2 x 2 = 4
23 = 2 x 2 x 2 = 8
24 = 2 x 2 x 2 x 2 = 16
25 = 2 x 2 x 2 x 2 x 2 = 32
26 = 2 x 2 x 2 x 2 x 2 x 2 = 64
27 = 2 x 2 x 2 x 2 x 2 x 2 x 2 = 128

The decimal equivalent of the base2 binary number 101010102 is:
(1x128)+(0x64)+(1x32)+(0x16)+(1x8)+(0x4)+(1x2)+(0x1) = 170

27 26 25 24 23 22 21 20 = 170
128 64 32 16 8 4 2 1
1 0 1 0 1 0 1 0

The rightmost or 1st column indicates 0 ones.   0
The 2nd column indicates 1 two. + 2
The 3rd column indicates 0 fours. + 0
The 4th column indicates 1 eight. + 8
The 5th column indicates 0 sixteens. + 0
The 6th column indicates 1 thirty-two. + 32
The 7th column indicates 0 sixty-fours. + 0
The 8th column indicates 1 one-hundred-twenty-eight. + 128
Adding these values together produces the decimal value   170

In any base system, the next column value to the left can be found by multiplying the current column value by the base number. This works because one is being added to the exponent for the next column. Adding one to the exponent means that the base should be multiplied by itself one more time. In the base2 binary number system, to get the column value of the next column, just multiply the current column value by 2.

Power 27 26 25 24 23 22 21 20
Value 2 x 64 = 128 2 x 32 = 64 2 x 16 = 32 2 x 8 = 16 2 x 4 = 8 2 x 2 = 4 2 x 1 = 2 1
Column 8th 7th 6th 5th 4th 3rd 2nd 1st

It's easy to extend the column values of a binary number by either adding one to the power of the current column or multiplying the current column by two. Here's what the column values are for a 16-bit or 2-byte binary number.

Power 215 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20
Value 32768 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1
Column 16th 15th 14th 13th 12th 11th 10th 9th 8th 7th 6th 5th 4th 3rd 2nd 1st

Because the column values begin to get quite large, it makes sense to begin using a shorthand to indicate these larger values. The number 1024 can be represented by Kilo (K). Using this shorthand makes the multiples of 1024 much easier to remember. Below is the same table using K to represent 1024.

Power 215 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20
Value 32K 16K 8K 4K 2K 1K 512 256 128 64 32 16 8 4 2 1
Column 16th 15th 14th 13th 12th 11th 10th 9th 8th 7th 6th 5th 4th 3rd 2nd 1st

Here's what 1K and above mean:
1K = 1 x 1024 = 1024
2K = 2 x 1024 = 2048
4K = 4 x 1024 = 4096
8K = 8 x 1024 = 8192
16K = 16 x 1024 = 16384
32K = 32 x 1024 = 32768

Often in computing, K is rounded to 1,000. Although this isn't quite accurate, it does make it easier to compare numbers when rough values are all that's needed. Note that many numeric shorthand letters in computing are based on the same concept as K (i.e., 1024K = 1Meg or 1M or roughly 1 million, 1024M = 1Gig or 1G or roughly 1 billion).

The decimal equivalent of the 16-bit or 2-byte base2 binary number 10101010101010102 is:
(1x32K)+(0x16K)+(1x8K)+(0x4K)+(1x2K)+(0x1K)+(1x512)+(0x256)+
(1x128)+(0x64)+(1x32)+(0x16)+(1x8)+(0x4)+(1x2)+(0x1) = 43,690

215 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20  = 43,690
32K 16K 8K 4K 2K 1K 512 256 128 64 32 16 8 4 2 1
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0

The rightmost or 1st column indicates 0 ones.   0
The 2nd column indicates 1 two. + 2
The 3rd column indicates 0 fours. + 0
The 4th column indicates 1 eight. + 8
The 5th column indicates 0 sixteens. + 0
The 6th column indicates 1 thirty-two. + 32
The 7th column indicates 0 sixty-fours. + 0
The 8th column indicates 1 one-hundred-twenty-eight. + 128
The 9th column indicates 0 two-hundred-fifty-sixes. + 0
The 10th column indicates 1 five-hundred-twelve. + 512
The 11th column indicates 0 one-thousand-twenty-fours. + 0
The 12th column indicates 1 two-thousand-forty-eight. + 2,048
The 13th column indicates 0 four-thousand-ninety-sixes. + 0
The 14th column indicates 1 eight-thousand-one-hundred-ninety-two. + 8,192
The 15th column indicates 0 sixteen-thousand-three-hundred-eighty-fours. + 0
The 16th column indicates 1 thirty-two-thousand-seven-hundred-sixty-eight. + 32,768
Adding these values together produces the decimal value   43,690

Converting from Binary (Base2) to Decimal (Base10)

Determining the decimal value of a binary number is simply a matter of adding up the decimal values of each column that contains a "1". For example, the decimal equivalent of the base2 binary number 100110012 is:
128+16+8+1 = 153

27 26 25 24 23 22 21 20 = 128+16+8+1 = 153
128 64 32 16 8 4 2 1
1 0 0 1 1 0 0 1

The trick is in knowing what decimal value each column represents. There are two basic methods for determining the decimal value of a column.

Method 1: Determine the exponent or power value of a column by counting to the left starting with zero in the rightmost column, then add the column values containing "1" in the binary number.

For example, in trying to determine the decimal value of the binary number 10012:
The first "1" is located in the rightmost or 0 column which has the value 20, 20 = 1.
Counting from 0 to the left, the next "1" is located in the 3 column which has the value 23, 23 = 2 x 2 x 2 = 8.
The decimal value of binary number 10012 = 8 + 1 = 9.

Exponent
or Power

3 2 1 0 = 23 + 20 = (2 x 2 x 2) + (1) = 8 + 1 = 9

Binary
Number

1 0 0 1

Method 2: Write out all column values by starting with 1 in the rightmost column and doubling each column to the left, then add the column values containing "1" in the binary number.

For example, in trying to determine the decimal value of the binary number 10012:
There are four columns.
The rightmost column has a decimal value of 1.
The next column to the left has double that value or 2 x 1 = 2.
The next column to the left has double that value or 2 x 2 = 4.
The next column to the left has double that value or 2 x 4 = 8.
Write out the column values over the binary number, then add up the column values where there is a "1".
The decimal value of binary number 10012 = 8 + 1 = 9.

Column
Value

8 4 2 1 = 8 + 1 = 9

Binary
Number

1 0 0 1

As you work with binary numbers more and more, you'll probably begin to memorize the column values for the 1st eight columns. This is because eight binary columns represent eight binary digits or eight bits or one byte. The byte is the most common grouping of bits you'll see when working with computer systems and networks. It's probably a good idea to memorize the column values of a binary byte from the start.

Power 27 26 25 24 23 22 21 20
Value 128 64 32 16 8 4 2 1
Column 8th 7th 6th 5th 4th 3rd 2nd 1st

Converting from Decimal (Base10) to Binary (Base2)

There are two basic methods to convert from a decimal number to a binary number. One method involves division, the other method involves column value comparison and subtraction.

Method 1: Divide the decimal number to be converted to binary by 2 resulting in an integer with a remainder (0 or 1), then divide the resulting integer by 2 resulting in another integer with a remainder (0 or 1). Continue dividing the resulting integers by 2 until the resulting integer is 0. The binary equivalent of the decimal number is the list of remainders in reverse order.
Note: This method also works for converting decimal to any base by dividing by that base instead of 2 (e.g., 16 for hexadecimal, 8 for octal, etc.).

For example, to convert the decimal number 170 to binary:

170  divided by 2 results in the integer   85  with a remainder of  0
85  divided by 2 results in the integer   42  with a remainder of  1
42  divided by 2 results in the integer   21  with a remainder of  0
21  divided by 2 results in the integer   10  with a remainder of  1
10  divided by 2 results in the integer   5  with a remainder of  0
5  divided by 2 results in the integer   2  with a remainder of  1
2  divided by 2 results in the integer   1  with a remainder of  0
1  divided by 2 results in the integer   0  with a remainder of  1

Listing the remainders in reverse order produces 10101010.
Thus, the decimal number 170 equals 101010102 in binary.

Method 2: Find the largest binary column value that will fit in the decimal number and place a "1" in that column. Subtract the decimal number from that column value. Find the largest binary column value that will fit in the result from the subtraction and place a "1" in that column. If needed, place a "0" in all columns between the last "1" and the "1" just placed. Subtract the decimal number from that column value. Repeat this process using the result from the subtraction until the result is 0, then place a "0" in all remaining columns.
Note: This method requires a reference to the binary column values unless of course you've memorized the values.

For example, to convert the decimal number 170 to binary:

Power 27 26 25 24 23 22 21 20
Value 128 64 32 16 8 4 2 1
Column 8th 7th 6th 5th 4th 3rd 2nd 1st

The largest column value that will fit in 170 is 128.
Place a "1" in the 128 column.

Power 27 26 25 24 23 22 21 20
Value 128 64 32 16 8 4 2 1
  1              

170 - 128 = 42
The largest column value that will fit in 42 is 32.
Place a "0" in all columns between the last "1" and the 32 column.
Place a "1" in the 32 column.

Power 27 26 25 24 23 22 21 20
Value 128 64 32 16 8 4 2 1
  1 0 1          

42 - 32 = 10
The largest column value that will fit in 10 is 8.
Place a "0" in all columns between the last "1" and the 8 column.
Place a "1" in the 8 column.

Power 27 26 25 24 23 22 21 20
Value 128 64 32 16 8 4 2 1
  1 0 1 0 1      

10 - 8 = 2
The largest column value that will fit in 2 is 2.
Place a "0" in all columns between the last "1" and the 2 column.
Place a "1" in the 2 column.

Power 27 26 25 24 23 22 21 20
Value 128 64 32 16 8 4 2 1
  1 0 1 0 1 0 1  

2 - 2 = 0
With 0 as the result, there are no more columns needed.
Place a "0" in all remaining columns.

Power 27 26 25 24 23 22 21 20
Value 128 64 32 16 8 4 2 1
  1 0 1 0 1 0 1 0

Here's another way to look at method 2. Let's convert decimal 170 to binary again using method 2 and referencing the table below.

Power 27 26 25 24 23 22 21 20
Value 128 64 32 16 8 4 2 1
Column 8th 7th 6th 5th 4th 3rd 2nd 1st

Is there a 128 in 170? Yes, then there is (1) 128 and 170-128 = 42 left over.
Is there a 64 in 42? No, then there are (0) 64's and 42 left over.
Is there a 32 in 42? Yes, then there is (1) 32 and 42-32 = 10 left over.
Is there a 16 in 10? No, then there are (0) 16's and 10 left over.
Is there an 8 in 10? Yes, then there is (1) 8 and 10-8 = 2 left over.
Is there a 4 in 2? No, then there are (0) 4's and 2 left over.
Is there a 2 in 2? Yes, then there is (1) 2 and 2-2 = 0 left over.
Is there a 1 in 0? No, then there are (0) 1's and 0 left over.

So we end up with the binary number 101010102.

128 64 32 16 8 4 2 1
1 0 1 0 1 0 1 0

In addition to the methods described above for converting from decimal-to-binary and binary-to-decimal, there are calculators available that will convert between different base number systems. The most readily available calculator that will do this can be found in Microsoft Windows under Start Programs Accessories. When in the calculator, you may need to change the "View" option from "Standard" to "Scientific".

Determining the number of bits needed to represent a given number of possible values

There are times when working with computer systems and networking that you'll need to determine how many bits are needed to represent a given number of possibilities. For example, if ten different values need to be represented in binary, the values 0-9 can be used. In binary, 0-9 are represented by 00002 through 10012. So, four bits would be needed to represent ten different binary values.

Decimal
Base10
Binary
Base2
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001

Note that the decimal values 10 through 15 or binary values 10102 through 11112 would not be used because they are not needed. Even though representing ten different values requires at least four bits, some of those values will not be used. Five or more bits could be used to represent ten different values, but that would mean even more values would go unused and the extra bits are not needed. Often when trying to determine the number of bits needed to represent a given number of possibilities, it's best to use the minimum number of bits rather than waste bits which can be used for other purposes.

The simplest method for determining the minimum number of bits needed to represent a given number of possibilities is to shift the binary column values to the right dropping the 1st column value. Those column values then represent the number of possible values for each extra column or bit.

The table below is used to determine the decimal value of a given binary number.

Power 27 26 25 24 23 22 21 20
Value 128 64 32 16 8 4 2 1
Column 8th 7th 6th 5th 4th 3rd 2nd 1st

If the column values are shifted to the right, with the rightmost value dropped, the new table will now show how many possibilities exist for each number of bits. Note that the exponent indicates the number of bits (i.e., 21 for 1 bit, 22 for two bits, etc.) as well as the possibilities for that many bits (i.e., 21 = 2 possibilities, 22 = 4 possibilities, etc.).

Power 28 27 26 25 24 23 22 21
Possible
Values
256 128 64 32 16 8 4 2
Number
of Bits
8 7 6 5 4 3 2 1

To illustrate this:
With one bit (21) there are two possible values - 0 and 1
With two bits (22) there are four possible values - 00, 01, 10 and 11
With three bits (23) here are eight possible values - 000, 001, 010, 011, 100, 101, 110 and 111
etc.

Now to find the number of bits needed for a given number of possible values, simply find the column value just large enough to contain the given number of possible values. For example, if ten values are needed, then the column value 16 is just large enough to hold the 10 values. This means 4 bits are needed to represent 10 possibilities. While 5 bits representing 32 possible values will work to represent 10 values, it's not the most efficient use of bits because the 5th bit is not needed.

Masking binary numbers

Binary masks are used in networking to separate binary numbers into two portions, and in the process, mask over the irrelevant portion of the number. The process used for binary masking is called ANDing.

The two digits available in binary are 0 and 1. 0 and 1 can be used to represent any either/or values, also called boolean logic values. Here are some examples.

Binary 0 Binary 1
Off On
False True
No Yes

Logical ANDing compares two conditions where each condition is either TRUE or FALSE. It requires that both conditions evaluate to TRUE (i.e., TRUE AND TRUE) in order for the final result to be TRUE. The binary digit 0 represents FALSE and 1 represents TRUE. Therefore only 1 AND 1 (or TRUE AND TRUE) will result in 1 (or TRUE) when comparing using logical ANDing. The logical ANDing table below explores all four possibilities using binary 0 and 1.

Condition 1 Condition 2 Result
TRUE
Binary 1
TRUE
Binary 1
TRUE and TRUE is TRUE
Binary 1 and 1 is 1
TRUE
Binary 1
FALSE
Binary 0
TRUE and FALSE is FALSE
Binary 1 and 0 is 0
FALSE
Binary 0
TRUE
Binary 1
FALSE and TRUE is FALSE
Binary 0 and 1 is 0
FALSE
Binary 0
FALSE
Binary 0
FALSE and FALSE is FALSE
Binary 0 and 0 is 0

 The way ANDing works with binary numbers involves comparing a binary number with a mask to determine which bits in the resulting binary number are 0 and 1. It's important to note that the purpose of the mask is to transform the original binary number into the resulting or ANDed binary number.

Suppose our original binary number is 101010102 and our binary mask is 111100002. Let's AND these and see the result.

101010102 original binary number
111100002 binary mask
101000002 result from ANDing

The way we come up with the result is by ANDing each column of the original number and the mask.

1 AND 1 is 1 10101010
11110000
1
0 AND 1 is 0 10101010
11110000
10
1 AND 1 is 1 10101010
11110000
101
0 AND 1 is 0 10101010
11110000
1010
1 AND 0 is 0 10101010
11110000
10100
0 AND 0 is 0 10101010
11110000
101000
1 AND 0 is 0 10101010
11110000
1010000
0 AND 0 is 0 10101010
11110000
10100000

Notice two points from this ANDing process:

  1. Wherever there is a binary 1 in the mask, the corresponding bit (same column position) in the original binary number ended up in the result.
  2. Wherever there is a binary 0 in the mask, the corresponding bit (same column position) in the result is 0 no matter what value was in that same bit (same column position) in the original number.
Original
bits
stay the
same
Original
bits
mask to
zeros
 
1 0 1 0 1 0 1 0 Original binary number
1 1 1 1 0 0 0 0 Binary Mask
1 0 1 0 0 0 0 0 Result from ANDing

Binary masks often have one set of contiguous ones followed by one set of contiguous zeros, which means that one side of the mask is all ones and the other side of the mask is all zeros. In other words, once the ones change to zeros, they don't change back again.

111100002   has one set of contiguous ones followed by one set of contiguous zeros
111011102   does NOT have one set of contiguous ones followed by one set of contiguous zeros

With this contiguous ones followed by contiguous zeros mask, seen in network addressing, the binary number is effectively separated into two portions: the portion ANDed through the ones and the portion ANDed through the zeros. The result of the bits ANDed through the one bits of the mask remains the same as the bits in the original binary number, while the result of the bits ANDed through the zero bits of the mask end up zero. The result from the ones portion of the mask remain significant, but the results from the zeros portion of the mask are masked to zeros and become irrelevant.

In networking, you will often find that addresses and masks expressed in bytes are entered in decimal notation. It is important to be able to see these decimal numbers in their binary representation to understand how the addressing works. Fortunately, because address masks are generally one set of contiguous ones followed by one set of contiguous zeros, there are only eight byte values to remember.

Common Binary Masks
Decimal
Base10
Binary
Base2
0 00000000
128 10000000
192 11000000
224 11100000
240 11110000
248 11111000
252 11111100
254 11111110
255 11111111

Because binary network addresses and masks are often expressed in decimal, the additional steps of converting from decimal-to-binary and binary-to-decimal are introduced to the binary ANDing process. For example, the decimal value of 48 and the decimal mask value of 224 produces the ANDed decimal result of 32. Here's how:

First convert the decimal value 48 and the decimal mask value 224 to binary so that binary ANDing can be performed.

Convert decimal 48 to binary :

Is there a 128 in 48? No, then there are (0) 128's and 48 left over.
Is there a 64 in 48? No, then there are (0) 64's and 48 left over.
Is there a 32 in 48? Yes, then there is (1) 32 and 48-32 = 16 left over.
Is there a 16 in 16? Yes, then there is (1) 16 and 16-16 = 0 left over.
Is there an 8 in 0? No, then there are (0) 8's and 0 left over.
Is there a 4 in 0? No, then there are (0) 4's and 0 left over.
Is there a 2 in 0? No, then there are (0) 2's and 0 left over.
Is there a 1 in 0? No, then there are (0) 1's and 0 left over.

128 64 32 16 8 4 2 1 = decimal 48
0 0 1 1 0 0 0 0

Convert decimal 224 to binary :

Is there a 128 in 224? Yes, then there is (1) 128 and 224-128 =  96 left over.
Is there a 64 in 96? Yes, then there is (1) 64 and 96-64 = 32 left over.
Is there a 32 in 32? Yes, then there is (1) 32 and 32-32 = 0 left over.
Is there a 16 in 0? No, then there are (0) 16's and 0 left over.
Is there an 8 in 0? No, then there are (0) 8's and 0 left over.
Is there a 4 in 0? No, then there are (0) 4's and 0 left over.
Is there a 2 in 0? No, then there are (0) 2's and 0 left over.
Is there a 1 in 0? No, then there are (0) 1's and 0 left over.

128 64 32 16 8 4 2 1 = decimal 224
1 1 1 0 0 0 0 0

Next, perform binary ANDing of the the converted decimal values producing the binary value 00100000.

001100002 Decimal value 48 in binary
111000002 Decimal mask value 224 in binary
001000002 result from ANDing

Finally, convert the binary ANDed result to decimal producing the decimal value 32.

128 64 32 16 8 4 2 1 = 1 x 32 = decimal 32
0 0 1 0 0 0 0 0

Decimal 48 ANDed through the decimal mask 224 produces the decimal value 32.
Note: The ANDing process takes place in binary.

Back to Understanding and Converting Base Number Systems