Binary Numbers, Explained Simply
Computers store everything — numbers, text, pictures, music — as binary: long strings of 0s and 1s. Once you see how binary counting works, every other operation follows naturally. You do not need any maths background to follow along.
Why only 0 and 1?
Inside a chip, a tiny wire is either on or off — there is no reliable "in between" it can hold. We write on as 1 and off as 0. Every number a computer knows is built out of just these two digits, which is why we call it base 2.
Place value: the one idea that unlocks everything
In our everyday decimal system, each position is worth ten times the position to its right: ones, tens, hundreds, thousands. Binary works the very same way, except each position is worth twice the one to its right:
| Position value |
… |
16 |
8 |
4 |
2 |
1 |
| Our number |
… |
1 |
0 |
1 |
1 |
0 |
To read a binary number, just add up the position values wherever there is a 1. So 10110 = 16 + 4 + 2 = 22. That is the entire trick — everything else builds on it.
Try reading these yourself before checking the right column:
| Binary |
Add the 1-positions |
Decimal |
0001 |
1 |
1 |
0101 |
4 + 1 |
5 |
1000 |
8 |
8 |
1111 |
8 + 4 + 2 + 1 |
15 |
Adding binary numbers
Addition works exactly like the schoolbook method you already know: line the numbers up, add each column from the right, and carry when a column overflows. The only twist is that in binary a column overflows the moment it reaches 2, because there is no digit "2." Here are all four cases:
| A + B |
Result |
| 0 + 0 |
0 |
| 0 + 1 |
1 |
| 1 + 0 |
1 |
| 1 + 1 |
0, and carry a 1 |
Let's add 1011 (11) and 0110 (6), one column at a time, right to left. The small top row tracks the carries:
carry: 1 1 1
1 0 1 1 (11)
+ 0 1 1 0 (6)
---------
1 0 0 0 1 (17)
Walking through it: column 1 is 1 + 0 = 1. Column 2 is 1 + 1 = 0, carry 1. Column 3 is 0 + 1 + the carried 1 = 0, carry 1. Column 4 is 1 + 0 + the carried 1 = 0, carry 1. That final carry becomes a brand-new leading digit. The answer 10001 = 16 + 1 = 17, exactly 11 + 6. ✔
Subtracting binary numbers
Subtraction uses borrowing, again just like decimal. Whenever you need to do 0 − 1, you borrow from the next column to the left: that 0 becomes 10 (which is 2 in binary), and 10 − 1 = 1. Let's subtract 0110 (6) from 1101 (13):
1 1 0 1 (13)
- 0 1 1 0 (6)
---------
0 1 1 1 (7)
The result 0111 = 4 + 2 + 1 = 7, exactly 13 − 6. ✔
Turning a decimal number into binary
The easiest method is divide by 2 and collect the remainders. Keep halving the number; each remainder (always a 0 or a 1) is one bit of the answer. The one thing to remember: you read the remainders from bottom to top. Converting 13:
| Divide |
Result |
Remainder (a bit) |
| 13 ÷ 2 |
6 |
1 |
| 6 ÷ 2 |
3 |
0 |
| 3 ÷ 2 |
1 |
1 |
| 1 ÷ 2 |
0 |
1 |
Reading the remainders upward gives 1101. Quick check: 8 + 4 + 1 = 13. ✔
Binary to hexadecimal
Hexadecimal (base 16) is a compact shorthand programmers love, because every group of four bits maps to exactly one hex digit. To convert, slice the binary into groups of four starting from the right, then translate each group on its own:
| Four bits |
Decimal |
Hex digit |
0000 |
0 |
0 |
0101 |
5 |
5 |
1001 |
9 |
9 |
1010 |
10 |
A |
1101 |
13 |
D |
1111 |
15 |
F |
So 1101 0110 becomes D6, and 1111 1111 (255) becomes FF. This is exactly why a single byte — eight bits — is so often written as just two hex digits.