Bytes and the American Standard Code for Information Interchange

The BIT is a very small unit of data and hardly used by itself in Computer Science.

It is often convenient in Science, in Technology, and in everyday life to group small quantities of items in larger packages.
For example:
  • 12 eggs = 1 dozen eggs
  • 1 week = 7 days
  • 1 meter = 1000 millimiters
  • 1 mole of particles of a gas = 6.02214076×1023  particles
  • 1 Fortnight = 14 days
In Computer Science we like to group 8 bits of data in one bundle calle a BYTE, for convenience sake and to handle data more efficiently.
 
One BYTE containing 8 bits will handle 256 values ranging from the decimal 0 (Zero) to the decimal 255.
1 1 1 1 1 1 1 1 BIT Value
7 6 5 4 3 2 1 0
REGISTER
POSITION
 
hence (11111111)2 = (255)10  (try to derive it yourself as an exercise)
 
To decode text charachters and other characters in stored computer data or documents, BYTES are often used to hold the value of indvidual characters.
The set of characters used in most computer systems is called the American Standard Code for Information Interchange, or ASCII for short.
You can look-up the entire ASCII table of characters online on may websites (here is an example http://www.asciitable.com/).
Note all the alphabet letters, characters, numbers, accents for foreign languages, brackets, parenthesis, and other punctuation marks from the ascii values 0 (zero) to 127.  Most keyboards will make use of this first set of 128 charcacters.
Characters 128 to 256 are reserved for special mathematical symbols and other less common characters.
 
How does ASCII decoding work?
Try this actiity first to get an idea of byte sizes and how characters are stored as digital entities.
  • Open up Wordpad or a simpe text editor on your computer
  • type the phrase: "The brown fox chased the birds"
  • save it on your desktop with the name bytes-test
  • Now open the file and look at its properties (or right-click on the icon on your desktop)
  • Note that the size is exactly 32 bytes (see image below)
  • How many characters are in the phrase   "The brown fox chased the birds" ?
  • Exactly 32 characters
  • Therefore, 32 ascii characters = 32 BYTES
How does the computer store the phrase "The brown fox chased the birds"?
Each character in its wn register or memory location - each character having a digital value according to the ascii code:
 
See table below for illustration .. notice the codes for the space as well ...
 
" T h e   b r o w n   f o x  
22 54 68 65 20 62 72 6f 77 6e 20 66 6f 78 20
 
Remember each one of the above "boxes" (memory registers)  is a BYTE and each BYTE contains 8 BIT.
Terefore for the character T with an ascii value of 54, and (54)10 = (110110)2, will be stored as
 
    1 1 0 1 1 0
 
By now you must have realized that for programming and large applications, the BYTE is also a small quantity.
These applications and systems often use many thousands of BYTES of data for storage and mathematical computing.
Therefore we make use of prefixes, much like the metric system, to indicate larger amounts. 
But remember that the metric system is based on multiples of 10 whereas the binary system is to base 2.
Therefore,  1 Km (kilometer) = 1000 m  but 1 KB = 1,024 bytes
 
Prefix
Symbol
 
Value in BYTES
Kilo
K
 
210 = 1,024
Mega
M
 
220 = 1,048,576
Giga
G
 
230 = 1,073,741,824
Tera
T
 
240 = 1,099,511,627,776
Peta
P
 
250 = 1,125,899,906,842,624
Exa
E
 
260 = 1,152,921,504,606,846,976
Zetta
Z
 
270 = 1,180,591,620,717,411,303,424
Yotta
Y
 
280 = 1,208,925,819,614,629,174,706,176