## Introduction into the binary system

### Binary numbers. Binary numeral system

In mathematics and digital electronics, a binary number is a number expressed in the binary numeral system, which is a base 2 numeral system. In this system, numeric values are represented using only two different symbols: typically 0 (zero) and 1 (one). The base 2 system is a positional numeric notation with a radix of 2. Binary is the way a computer holds information, the 1's and 0's.

Examples of binary numbers: 01, 10, 001, 010, 011, 100, 101, 110, 111, etc.

The decimal number (denary) system we're all familiar with is a base-ten system, meaning it uses ten distinct digits - 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.

Examples of numbers in the decimal system: 1, 2, 3, 10, 101, 304, 579, 2746, 54206, etc.

### Counting in binary system

After 0 and 1 comes 10. In fact, whenever a number made up of entirely 1's is reached, an extra digit is added. This is exactly the same thing that happens in the decimal system when a number made up of entirely 9's is reached.

#### Here are the first 32 (33) numbers expressed in binary and their decimal equivalent:

Decimal number | Binary number |

0_{(10)} | 0_{(2)} |

1_{(10)} | 1_{(2)} |

2_{(10)} | 10_{(2)} |

3_{(10)} | 11_{(2)} |

4_{(10)} | 100_{(2)} |

5_{(10)} | 101_{(2)} |

6_{(10)} | 110_{(2)} |

7_{(10)} | 111_{(2)} |

8_{(10)} | 1000_{(2)} |

9_{(10)} | 1001_{(2)} |

10_{(10)} | 1010_{(2)} |

11_{(10)} | 1011_{(2)} |

12_{(10)} | 1100_{(2)} |

13_{(10)} | 1101_{(2)} |

14_{(10)} | 1110_{(2)} |

15_{(10)} | 1111_{(2)} |

16_{(10)} | 1 0000_{(2)} |

17_{(10)} | 1 0001_{(2)} |

18_{(10)} | 1 0010_{(2)} |

19_{(10)} | 1 0011_{(2)} |

20_{(10)} | 1 0100_{(2)} |

21_{(10)} | 1 0101_{(2)} |

22_{(10)} | 1 0110_{(2)} |

23_{(10)} | 1 0111_{(2)} |

24_{(10)} | 1 1000_{(2)} |

25_{(10)} | 1 1001_{(2)} |

26_{(10)} | 1 1010_{(2)} |

27_{(10)} | 1 1011_{(2)} |

28_{(10)} | 1 1100_{(2)} |

29_{(10)} | 1 1101_{(2)} |

30_{(10)} | 1 1110_{(2)} |

31_{(10)} | 1 1111_{(2)} |

32_{(10)} | 10 0000_{(2)} |

As you can see, there are 32 distinct numbers that can be represented on 5 digits or less (1 through 31, as well as 0). This can be also calculated, because 32 = 2^{5}. The total quantity of distinct numbers that can be represented in 8 digits is 2^{8} = 256. 1 through 255 as well as 0. So 255 in binary is 11111111. Because binary uses base two as opposed to the decimal base ten, the numbers get larger much more quickly, but they still obey the same principles.

### Binary Letters

There are multiple methods of representing letters and symbols in binary code. These methods are called encodings. For example, the ASCII encoding assigns unique binary bytes to 128 different characters. This makes it possible to encode any string of text. Below you can find the alphabet letters in binary.

#### Alphabet in binary, capital letters & lower case

Capital letter | Binary code | Lower case | Binary code |

A | 0100 0001 | a | 0110 0001 |

B | 0100 0010 | b | 011 00010 |

C | 0100 0011 | c | 011 00011 |

D | 0100 0100 | d | 011 00100 |

E | 0100 0101 | e | 0110 0101 |

F | 0100 0110 | f | 0110 0110 |

G | 0100 0111 | g | 0110 0111 |

H | 0100 1000 | h | 0110 1000 |

I | 0100 1001 | i | 0110 1001 |

J | 0100 1010 | j | 0110 1010 |

K | 0100 1011 | k | 0110 1011 |

L | 0100 1100 | l | 0110 1100 |

M | 0100 1101 | m | 0110 1101 |

N | 0100 1110 | n | 0110 1110 |

O | 0100 1111 | o | 0110 1111 |

P | 0101 0000 | p | 0111 0000 |

Q | 0101 0001 | q | 0111 0001 |

R | 0101 0010 | r | 0111 0010 |

S | 0101 0011 | s | 0111 0011 |

T | 0101 0100 | t | 0111 0100 |

U | 0101 0101 | u | 0111 0101 |

V | 0101 0110 | v | 0111 0110 |

W | 0101 0111 | w | 0111 0111 |

X | 0101 1000 | x | 0111 1000 |

Y | 0101 1001 | y | 0111 1001 |

Z | 0101 1010 | z | 0111 1010 |

* Spaces were used inside binary codes, to group digits by four, in order to make them more readable |

### How computer works

At a physical level, the 0's and 1's are stored in the central processing unit (CPU) of a computer system using logic gates or transistors. Transistors are microscopic switches that control the flow of electricity. If a current passes through the transistor (switch closed), this represents a 1. If a current doesn't pass through (switch open), this represents a 0. Because of its straightforward implementation in digital electronic circuitry using logic gates, the binary system is used internally by almost all modern computers and computer-based devices. Each digit is referred to as a bit. The term also refers to any digital encoding/decoding system in which there are exactly two possible states. In digital data memory, storage, processing, and communications, the 0 and 1 values are sometimes called "low" and "high," respectively. Binary information is also transmitted using magnetic properties; the two different types of polarities are used to represent zeros and ones. An optical disk, such as a CD-ROM or DVD, also stores binary information in the form of pits and lands (the area between the pits).

Computer software translates between binary information and the information you actually work with on a computer such as decimal numbers, text, photos, sound, and video. Binary information is sometimes also referred to as machine language since it represents the most fundamental level of information stored in a computer system.

### Bits and bytes

Bits can be grouped together to make them easier to work with. A group of 8 bits is called a byte. Other groupings include:

Grouping | Equivalent |

Nibble | 4 bits (half a byte) |

Byte | 8 bits |

Kilobyte (KB) | 1024 bytes (or 1024 x 8 bits) |

Megabyte (MB) | 1024 kilobytes (or 1024 bytes x 1024 bytes = 1048576 bytes) |

Gigabyte (GB) | 1024 Megabytes |

Terabyte (TB) | 1024 Gigabytes |

Most computers can process millions of bits every second. A hard drive's storage capacity is measured in Gigabytes or Terabytes. RAM is often measured in Megabytes or Gigabytes (as of 2016...).