*There are 10 type of people in the world — those who understand binary and those who don't. This is a riddle often printed on t-shirts*. After reading this page you will definitely understand binary (and the riddle).*

Humans have ten fingers and ten toes. As children, we learn to count using a decimal number system. Decimal number system has ten distinct digits — 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. We learn about the unit place, 10's place, 100's place and so on. But that is not the only number system possible.

Computers use a binary number system, which has two distinct digits — 0 and 1. That is all. The two number systems are related and here is how we can transfer what we already know about decimal numbers to binary numbers:

The number `5432`

has 5 in the 1000th place, 4 in the 100th place, 3 in the 10th place, and 2 in the 1 place (aka unit place). With decimal numbers these are powers of 10. Similarly with binary numbers each 'place' is a power of 2 — 1, 2, 4, 8, 16, 32, 64, 128, and so on. So the number `1101`

in Base 2 is equal to the number 8+4+1 = 13 in Base 10.

We can do all of the arithmetic operations with binary (aka Base 2) numbers that we do with decimal numbers as well. Below is an example of decimal and binary addition. Try to do the binary to decimal conversation yourself first and then verify.

### So What / Why does this Matter?

Binary numbers are present everywhere in the digital world of computers. The two numbers actually represent two states of a transistor. A transistor is basic building block of modern computer hardware, such as the microprocessor.

Below are two concrete examples of where you may run into binary numbers — Hex code for colors used in web design, IP address used to identify a computer on the Internet. See if you can come up with the binary representation of the for both — the Hex color code as well as the IP address — before looking at the answer. Also try saying the binary string out loud. You can get a nice rhythm, it's fun!

Hex color code expanded to 1 and 0s:

IP address expanded to 1 and 0s:

### Other Tidbits / Connections:

— Why is the least significant bit (LSB) 1 in both cases? Because that is the 0 power. It is a mathematical convention that any integer raised to power 0 is equal to 1. So 2^{0} = 1 and 10^{0} = 1 also and 42^{0} = 1 and so on.

— A `bit`

is a single binary digit. A `byte`

is 8 bits. 1 kilobyte (KB) is 1024 bytes — 2^{10} and 1 megabyte (MB) is 1048576 bytes — 2^{20}.

— The largest number that can be represented by n digits is 2^{n} - 1. For example, with 8 bits we can represent 2^{8} - 1. Which 256 - 1 or 255. This is the same for decimal numbers. For example, with 4 digits we can represent 10^4 - 1. Or 10000 - 1 = 9999. This intuitively makes sense that the largest number we can represent with 4 digits would be if all the digits were 9's.

— There are other number systems such as Hexadecimal and Octal, with 16 digits and 8 digits respectively. For the Hex number systems since 16 symbols are needed we decided to just start using the alphabet once we run of the ten digits. So 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.

That's all. There you have it! Now you know everything about the concept of binary numbers!**

*Oh and about that joke — the Base for that 10 is not decimal but binary. And 10 in binary represents the number 2. So there are two types of people in the world...*

**Personally I don't like this joke, clever but rather supercilious :) *

**That's not true. With technical concepts there's always more. But this is a solid foundation, a jumping of point! Go forth and explore!