Binary Numbers

Understanding Binary Numbers
(How Computers Store Information)



A computer is an electronic device, it uses electricity to store information. If you think of a computer as being thousands of tiny switches, you can see that each switch can either be turned ON, or turned OFF. If you were to determine that a switch left in the OFF position would represent the number "ZERO", and that a switch turned to the ON position would represent the number "ONE", you would have the simplest method for storing a single value. This is the basis for the binary number system! A single binary digit is called a "BIT", a bit may be either a "ZERO" (OFF), or a "ONE" (ON).
 
 
SWITCH POSTION
NUMBER VALUE
OFF
0
ON
1

Unless you have a very small bank account, this doesn't seem like a great method of storing numbers. Think about this... with a single switch we can store two numbers, either a "ZERO" or a "ONE". What happens if we add more switches? Imagine a row with four switches. Each switch can either be ON or OFF just like the single switch... so how many numbers can we make?
 
 

SWITCH D
SWITCH C
SWITCH B
SWITCH A
NUMBER VALUE
OFF
OFF
OFF
OFF
0
OFF
OFF
OFF
ON
1
OFF
OFF
ON
OFF
2
OFF
OFF
ON
ON
3
OFF
ON
OFF
OFF
4
OFF
ON
OFF
ON
5
OFF
ON
ON
OFF
6
OFF
ON
ON
ON
7
ON
OFF
OFF
OFF
8
ON
OFF
OFF
ON
9
ON
OFF
ON
OFF
10
ON
OFF
ON
ON
11
ON
ON
OFF
OFF
12
ON
ON
OFF
ON
13
ON
ON
ON
OFF
14
ON
ON
ON
ON
15

As you can see, by adding only three more switches we increased our storage capacity from only two numbers (0) or (1) to sixteen numbers, (0) to (15). Can you see a pattern to the numbers? Every time switch "A" is turned ON, the number is an odd number. This is because switch "A" has a weight of (1). The next switch, "B" has a weight of (2), then switch "C" has a weight of (4), and lastly switch "D" has a weight of (8). To get any number simply add up the weights of the switches that are turned ON.

EXAMPLE: What number would you get if the switches were set like this: ON - OFF - ON - OFF ?
The values (weights) would look like this...
8 + 0 + 2 + 0 = 10


SWITCH
D = 8
SWITCH 
C = 4
SWITCH 
B = 2
SWITCH
A = 1
NUMBER STORED
ON OFF ON OFF 8 + 2 = 10

The name for a group of four switches, or four binary digits is called a NIBBLE. A NIBBLE is made of four BITS and can store numbers from 0 to 15, for a total of 16 possible numbers. If you were to connect two NIBBLES together, you would have a group consisting of eight BITS. A group of eight BITS is called a BYTE. One BYTE can store numbers from 0 to 255, for a total of 256 numbers.

If you were to then connect two BYTES together you would have four NIBBLES, or a total of 16 BITS. With this many BITS, you can store large numbers from 0 to 65535, for a total of 65536 numbers! Let's take another look at this...
 
 
 

WORD BYTE NIBBLE BIT LARGEST NUMBER POSSIBLE
1/16 1/8 1/4 1
(0 OR 1)
1/4 1/2 1 4 16 
(0 TO 15)
1/2 1 2 8 256 
(0 TO 255)
1 2 4 16 65536 
(0 TO 65535)