How to Count in Binary- Number System Conversion Tutorial
What Binary Actually Is
Binary is a number system that uses only two digits: 0 and 1. That's it. Every single thing your computer does comes down to these two states—on or off, true or false, voltage or no voltage.
Humans use decimal (base-10). We have 10 digits (0-9) and we count by powers of 10. Binary works the same way, except it's base-2. Powers of 2 instead of powers of 10.
Why You Need to Know This
Unless you're writing code at the hardware level, you'll rarely count in binary by hand. But understanding it helps when debugging, working with IP addresses, understanding file sizes, or making sense of hex color codes.
Programmers who skip this part always regret it later.
How Binary Counting Actually Works
Think of a light switch. It's either on (1) or off (0). Binary works the same way.
When you count in binary:
- Start at 0
- Add 1 to get 1
- Add 1 again and you hit a wall—there's no digit for "two." So you reset to 0 and carry a 1 to the next column
- 10 in binary means "two" (one group of two, zero left over)
- 11 in binary means "three" (one group of two, plus one)
- 100 means "four" (one group of four, zero groups of two, zero left over)
The Place Values
Each position in a binary number represents a power of 2. Reading right to left:
- Rightmost bit: 2⁰ = 1
- Next bit: 2¹ = 2
- Next bit: 2² = 4
- Next bit: 2³ = 8
- And so on...
A binary number like 10110 breaks down as:
(1 × 16) + (0 × 8) + (1 × 4) + (1 × 2) + (0 × 1) = 22
Binary to Decimal Conversion
Here's the straightforward method:
- Write down the place values (1, 2, 4, 8, 16, 32...)
- Line up your binary digits below them
- Multiply each place value by its binary digit
- Add up the results
Example: Convert 11001 to decimal
- Place values: 16, 8, 4, 2, 1
- Binary digits: 1, 1, 0, 0, 1
- Multiply: (1×16) + (1×8) + (0×4) + (0×2) + (1×1)
- Add: 16 + 8 + 0 + 0 + 1 = 25
Decimal to Binary Conversion
Two methods work here. Use whichever clicks for you.
Method 1: Division
- Divide your number by 2
- Write down the remainder (0 or 1)
- Divide the result by 2, again writing the remainder
- Repeat until you hit 0
- Read the remainders bottom to top
Example: Convert 23 to binary
- 23 ÷ 2 = 11 remainder 1
- 11 ÷ 2 = 5 remainder 1
- 5 ÷ 2 = 2 remainder 1
- 2 ÷ 2 = 1 remainder 0
- 1 ÷ 2 = 0 remainder 1
Read bottom to top: 10111
Check: (1×16) + (0×8) + (1×4) + (1×2) + (1×1) = 16 + 0 + 4 + 2 + 1 = 23 ✓
Method 2: Subtraction
Start with the largest power of 2 that fits in your number. Subtract it. Repeat with the next power down.
Example: Convert 45 to binary
- Largest power of 2 ≤ 45? 32. Subtract: 45 - 32 = 13
- Next power: 16 is too big. 8 fits. Subtract: 13 - 8 = 5
- Next power: 4 fits. Subtract: 5 - 4 = 1
- Next power: 2 is too big. 1 fits. Subtract: 1 - 1 = 0
Used: 32, 8, 4, 1. Result: 101101
Hexadecimal: The Shortcut Programmers Use
Binary gets long fast. 255 in binary is 11111111—eight digits to remember one byte. Hexadecimal (base-16) solves this.
Hex uses 16 symbols: 0-9, then A-F for values 10-15.
| Decimal | Binary | Hex |
|---|---|---|
| 0 | 0000 | 0 |
| 1 | 0001 | 1 |
| 9 | 1001 | 9 |
| 10 | 1010 | A |
| 15 | 1111 | F |
| 16 | 00010000 | 10 |
| 255 | 11111111 | FF |
One hex digit covers exactly four binary digits. That's why hex is everywhere in programming—you see #FF5733 for colors instead of a 24-digit binary string.
Quick Reference: Common Binary Numbers
| Decimal | Binary | Power of 2 |
|---|---|---|
| 1 | 1 | 2⁰ |
| 2 | 10 | 2¹ |
| 4 | 100 | 2² |
| 8 | 1000 | 2³ |
| 16 | 10000 | 2⁴ |
| 32 | 100000 | 2⁵ |
| 64 | 1000000 | 2⁶ |
| 128 | 10000000 | 2⁷ |
| 255 | 11111111 | 2⁸ - 1 |
Getting Started: Practice Problems
Try these conversions. Answers below—don't cheat until you've tried.
- Convert 67 to binary
- Convert 101010 to decimal
- What comes after 111 in binary?
- Convert 100100 to decimal
Answers
- 67 = 1000011 (64 + 2 + 1)
- 101010 = 42 (32 + 8 + 2)
- 111 + 1 = 1000 (eight)
- 100100 = 36 (32 + 4)
What Actually Matters
You don't need to be a binary master. Memorize the powers of 2 up to 2¹⁰ (1024). Know that 8 bits make a byte. Remember that binary to hex conversion is just grouping by four.
The rest comes with practice. Open a calculator app, switch it to programmer mode, and mess around. That's how you actually learn this stuff.