Skip to main content

How Binary Numbers Work: A Beginner’s Guide

RA
Rafsan Alhad Founder & Editorial Director
4 min read

Every photo you take, every message you send, and every video you stream is stored as binary – strings of 1s and 0s. But how do two digits represent everything a computer does? This guide explains how binary numbers work, from counting to text encoding, with concrete examples you can follow along with.

What Is Binary?

Binary is a base-2 number system. While the decimal system we use every day has ten digits (0-9), binary has only two: 0 and 1. Each binary digit is called a bit (short for “binary digit”).

Computers use binary because their hardware is built from transistors that have two stable states: off (0) and on (1). With billions of transistors switching billions of times per second, those two states are enough to represent any data – numbers, text, images, sound, and video.

A group of 8 bits is called a byte. One byte can represent 256 different values (from 0 to 255), which is enough for every character on a standard keyboard.

How to Count in Binary

Counting in binary follows the same logic as decimal, except you “carry” after 1 instead of after 9:

Decimal Binary
0 0
1 1
2 10
3 11
4 100
5 101
6 110
7 111
8 1000
9 1001
10 1010

Notice the pattern: just as decimal 9 rolls over to 10, binary 1 rolls over to 10. Each new column to the left is worth twice the previous one.

Place Values: Why 1010 Equals 10

In decimal, each position represents a power of 10 (ones, tens, hundreds). In binary, each position represents a power of 2:

“`

128 64 32 16 8 4 2 1

0 0 0 0 1 0 1 0

“`

To convert 1010 to decimal, add up the place values where there’s a 1:

  • The 8’s place has a 1 → 8
  • The 4’s place has a 0 → 0
  • The 2’s place has a 1 → 2
  • The 1’s place has a 0 → 0

8 + 2 = 10. That’s it.

Let’s try a longer one: 11010111

  • 128 + 64 + 0 + 16 + 0 + 4 + 2 + 1 = 215

You can verify this instantly with our binary converter – just paste any binary string and see its decimal value.

How Binary Represents Text

Computers turn text into binary using character encoding. The most common standard is ASCII, where each character maps to a number from 0 to 127, and that number is stored as 8 bits.

For example:

  • The letter A is ASCII 65, which is 01000001 in binary
  • The letter a is ASCII 97, which is 01100001 in binary
  • A space is ASCII 32, which is 00100000 in binary

So the word “Hi” becomes:

“`

H = 72 = 01001000

i = 105 = 01101001

“`

Try typing “Hi” into our binary converter and watch it encode to binary in real time – then flip the direction to decode binary back to text.

Modern systems use Unicode (UTF-8), which extends ASCII to cover every writing system in the world, from Arabic to emoji. The first 128 Unicode characters are identical to ASCII, which is why plain English text looks the same in both.

Binary in Everyday Computing

You encounter binary constantly, even if you never see the 1s and 0s:

  • File sizes: A kilobyte is 1,024 bytes (2¹⁰), a megabyte is 1,048,576 bytes (2²⁰). That’s why storage never divides neatly by 1,000.
  • IP addresses: The address 192.168.1.1 is really four 8-bit binary numbers: 11000000.10101000.00000001.00000001.
  • Colors: The hex color #FF0000 (red) is three bytes – FF (255) red, 00 green, 00 blue – each byte an 8-bit binary value.
  • Permissions: On Linux, file permission 755 is three 3-bit binary numbers (111 101 101) controlling read, write, and execute access.

Common Binary Terms

Term Meaning
Bit A single 0 or 1
Byte 8 bits
Nibble 4 bits (half a byte)
Kilobyte (KB) 1,024 bytes
Megabyte (MB) 1,024 KB
Gigabyte (GB) 1,024 MB

Frequently Asked Questions

Why do computers use binary instead of decimal?

Computer hardware is built from transistors that are either on or off – two states. Binary maps perfectly to this: 1 for on, 0 for off. Building hardware with ten distinct voltage levels (for decimal) would be far less reliable and far more expensive.

What is the largest number one byte can hold?

One byte (8 bits) can represent values from 0 to 255 – that’s 256 total values (2⁸ = 256). The binary number 11111111 equals 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255.

How do I convert binary to decimal by hand?

Write the powers of 2 above each bit (1, 2, 4, 8, 16, 32, 64, 128 from right to left), then add the values under every 1. For example, 10110 = 16 + 4 + 2 = 22.

Is binary the same as machine code?

Machine code is written in binary, but not all binary is machine code. Binary is just a number system – it can represent text, images, or instructions. Machine code specifically means binary instructions the CPU executes directly.

How many bits do I need to represent the number 1,000?

You need 10 bits. The largest 9-bit number is 511 (2⁹ − 1), and 1,000 in binary is 1111101000 – a 10-bit number. In general, you need ⌈log₂(n+1)⌉ bits to represent the number n.

Interactive Utilities

Related Interactive Calculators & Tools

Browse 2,700+ Tools →
Developer Free & Client-Side

ASCII to Binary Converter — Text to Binary & Binary to Text (Free, UTF-8)

Free ASCII to binary converter: encode text to 8-bit binary and decode binary back to text. UTF-8 aware (é, 中, emoji), per-character bit visualizer, spacing & MSB/LSB options. 100% client-side — nothing uploaded.

Launch Tool →
Converters Free & Client-Side

Binary Converter

Convert text to binary and decode binary to text.

Launch Tool →
Converters Free & Client-Side

Binary Decoder – Binary to English, ASCII Code Generator

Binary decoder, binary to English, ASCII code generator, words to binary, binary numbers base 10, convert bytes, binary code encoder, image to binary converter, symbols to binary.

Launch Tool →