Stewdent.eu
▾

Binary Numbers

An introduction to the binary number system, explaining how computers represent and process all data using only 0s and 1s.

Last updated: 14 January 2026

★☆☆☆☆ Level 1computingDatabinarynumber-systemsLesson6 min read

Report an error

Why Do Computers Use Binary?

At the heart of every computer are billions of tiny electronic switches called transistors. Each transistor has exactly two states: it is either on (current flowing through it) or off (no current). There is no in-between.

This physical reality shapes everything about how computers store and process data. Because a transistor can only be in one of two states, computers use a number system with exactly two digits — 0 (off) and 1 (on). This is called the binary number system, or base-2.

Every piece of information inside a computer — text, images, music, programs — is ultimately stored as a long sequence of 0s and 1s. Understanding binary is therefore understanding the most fundamental language of computing.

Counting in Binary

The everyday number system we use is base-10 (decimal). It uses ten digits (0–9), and each position in a number represents a power of 10:

Decimal 345 = (3 × 100) + (4 × 10) + (5 × 1)
            = (3 × 10²) + (4 × 10¹) + (5 × 10⁰)

Binary works the same way, but each position represents a power of 2 instead:

Position2^72^62^52^42^32^22^12^0
Value1286432168421

In binary you can only place a 0 or a 1 in each position. Here is how you count from 0 to 7 in binary:

DecimalBinary
0000
1001
2010
3011
4100
5101
6110
7111

Once all digits are 1, you need an extra digit to go higher — just as decimal goes from 9 to 10.

Note

With 3 binary digits (bits) you can represent 8 different values (0 to 7). With 4 bits you can represent 16 values (0 to 15). In general, n bits can represent 2 to the power of n distinct values.

Converting Binary to Decimal

To convert a binary number to decimal, write out the place values and add up the positions where there is a 1.

Example: convert 1011 to decimal

Position values:  8   4   2   1
Binary digits:    1   0   1   1

= (1 × 8) + (0 × 4) + (1 × 2) + (1 × 1)
= 8 + 0 + 2 + 1
= 11

So binary 1011 equals decimal 11.

Example: convert 10110 to decimal

Position values: 16   8   4   2   1
Binary digits:    1   0   1   1   0

= 16 + 0 + 4 + 2 + 0
= 22

Converting Decimal to Binary

To convert decimal to binary, repeatedly divide by 2 and record the remainders, then read the remainders from bottom to top.

Example: convert decimal 13 to binary

13 ÷ 2 = 6 remainder 1
 6 ÷ 2 = 3 remainder 0
 3 ÷ 2 = 1 remainder 1
 1 ÷ 2 = 0 remainder 1

Reading remainders bottom to top: 1101

Check: 8 + 4 + 0 + 1 = 13. Correct.

Tip

When converting to binary, work from the largest power of 2 that fits. For 25: does 16 fit? Yes (25 - 16 = 9). Does 8 fit into 9? Yes (9 - 8 = 1). Does 4 fit into 1? No. Does 2 fit into 1? No. Does 1 fit? Yes. Result: 11001.

Bits, Bytes, and Beyond

A single binary digit is called a bit (binary digit). Bits are the smallest possible unit of information.

Because a single bit can only hold a 0 or a 1, real data is stored in groups:

UnitSizeWhat it can store
Bit1 bitA single 0 or 1
Byte8 bitsOne character (e.g. the letter "A")
Kilobyte (KB)1 024 bytesA short text document
Megabyte (MB)1 024 KBA medium-resolution photo
Gigabyte (GB)1 024 MBA full-length HD film

A byte (8 bits) is the standard unit for measuring file sizes and storage capacity. With 8 bits, 256 different values can be represented (from 0 to 255), which is enough to encode every letter, digit, and common punctuation mark in the ASCII character set.

Note

The letter "A" is stored as the binary value 01000001 (decimal 65). Every character on your keyboard has its own agreed-upon binary code. When you type a message, the computer is working with sequences of these 8-bit values the entire time.

Binary in Everyday Computing

Binary is not just an abstract concept — it is present in everything your computer does:

  • Colours on screen are stored as three bytes (red, green, blue), each 0–255.
  • Sound is stored as millions of binary measurements per second.
  • Programs are stored as binary instructions the CPU executes directly.

Learning binary gives you the foundation to understand how computers handle memory addressing, networking, encryption, and much more.

Practice Problems

Convert binary 1100 to decimal.

Show answer
1100 in binary = (1 × 8) + (1 × 4) + (0 × 2) + (0 × 1) = 12 in decimal.

Convert decimal 9 to binary.

Show answer
9 = 8 + 1, so binary is 1001.

How many different values can 4 bits represent?

Show answer
2 to the power of 4 = 16 values (from 0 to 15).

How many bytes are in a kilobyte?

Show answer
1 kilobyte = 1 024 bytes.