# Binary Numbers

When we deal with computers, we often hear about binary numbers. But why do computers use binary, and not the regular numbers we use every day? The answer lies in how computers are built. They use electrical signals that can be either on or off. To keep it simple, binary numbers fit this system perfectly because they are made up only of zeros (`0`s) and ones (`1`s), representing `off` and `on` states.

### What is a Binary Number?

A binary number is a number expressed in the base-2 numeral system. This system uses only two digits, 0 and 1. Every digit in a binary number is called a bit. For example, the binary number `101` has three bits, while `1001011` has 7 bits.

### How to Read Binary Numbers

Reading binary is a little different from reading numbers in the decimal system (base-10), which uses ten digits (0 to 9). In binary, each bit represents an increasing power of 2, starting from the rightmost bit, which is .
Here's an example with the binary number `1011`:
• The rightmost bit represents
• The next bit to the left represents
• The next bit to the left represents
• The leftmost bit represents .
To find out what `1011` means in decimal:
``````1 Β· (2^3) = 8   Leftmost bit
0 Β· (2^2) = 0   Next bit
1 Β· (2^1) = 2   Next bit
1 Β· (2^0) = 1   Rightmost bit``````
Add these up: `8 + 0 + 2 + 1 = 11`. So, `1011` in binary is `11` in decimal.

### Comparing Binary to Our Everyday Decimal Numbers

Think about how we count. We start with 0, then go to 1, 2, 3, and so on up to 9. But what happens when we reach 9 and want to count one more? Well, we run out of digits. So, we put a 1 in the next place to the left and reset the rightmost digit back to zero, giving us 10.
π‘
In essence, weβre saying, "We've run out of digits in this 'column,' so letβs add another 'column' to the left." Just like you'd carry over in addition, you "carry over" a digit to the next position.
The same exact thing happens with binary numbers. Here we only have two digits: `0` and `1`, so instead of running out of digits after `9`, we run out after `1`. So, what should we do next? We carry over a `1` to the left, resetting the digit we just counted to 0. In binary, the counting proceeds as 0, 1, 10, 11, 100, 101, and so on.
Β
If we represent the numbers as digits, we would have a pretty similar picture for both decimal and binary numbers:

#### Decimal: 5432

``````5 Β· (10^3) = 5000  Leftmost digit
4 Β· (10^2) = 400   Next digit
3 Β· (10^1) = 30    Next digit
2 Β· (10^0) = 2     Rightmost digit

5000 + 400 + 30 + 2 = 5432``````

#### Binary: 1011

``````1 Β· (2^3) = 8   Leftmost bit
0 Β· (2^2) = 0   Next bit
1 Β· (2^1) = 2   Next bit
1 Β· (2^0) = 1   Rightmost bit

8 + 0 + 2 + 1 = 11``````
This way one can convert binary (base-2) numbers to decimal (base-10).
Β