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:

The Place Values

Each position in a binary number represents a power of 2. Reading right to left:

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:

  1. Write down the place values (1, 2, 4, 8, 16, 32...)
  2. Line up your binary digits below them
  3. Multiply each place value by its binary digit
  4. Add up the results

Example: Convert 11001 to decimal

Decimal to Binary Conversion

Two methods work here. Use whichever clicks for you.

Method 1: Division

  1. Divide your number by 2
  2. Write down the remainder (0 or 1)
  3. Divide the result by 2, again writing the remainder
  4. Repeat until you hit 0
  5. Read the remainders bottom to top

Example: Convert 23 to binary

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

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
4 100
8 1000
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.

  1. Convert 67 to binary
  2. Convert 101010 to decimal
  3. What comes after 111 in binary?
  4. Convert 100100 to decimal

Answers

  1. 67 = 1000011 (64 + 2 + 1)
  2. 101010 = 42 (32 + 8 + 2)
  3. 111 + 1 = 1000 (eight)
  4. 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.