0100
1011
0110
1101

The Language of Binary

How computers think in 1s and 0s

1

What is Binary?

Binary is a number system that uses only two digits: 0 and 1. Computers use binary because their circuits can only be in two states - ON or OFF, like a light switch!

💡
0
OFF
💡
1
ON

👉 Click the lightbulbs to toggle them!

💡 Fun Fact
Each 0 or 1 in binary is called a bit (short for "binary digit"). It's the smallest piece of data a computer can store!
2

Counting in Binary

In our decimal system, each position is worth 10x more than the one to its right (1, 10, 100...). In binary, each position is worth 2x more (1, 2, 4, 8, 16...)!

0 128
0 64
0 32
0 16
0 8
0 4
0 2
0 1
Decimal Value
0
0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 = 0

👉 Click the bits to toggle them, or use the +/- buttons to count!

3

Binary to Decimal

To convert binary to decimal, add up the values of all the "1" positions. Try typing a binary number below!

Decimal (base 10)
0
🧠 Quick Examples
1111 = 8 + 4 + 2 + 1 = 15
10101010 = 128 + 32 + 8 + 2 = 170
11111111 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255
4

Decimal to Binary

To convert decimal to binary, find which powers of 2 add up to your number. Start with the biggest power of 2 that fits!

Binary (base 2)
00000000
5

Text as Binary (ASCII)

Computers store letters as numbers using a system called ASCII. Each letter has a number, and that number is stored in binary!

H
72
01001000
i
105
01101001
💬 ASCII Examples
A = 65 = 01000001 | a = 97 = 01100001
0 = 48 = 00110000 | Space = 32 = 00100000
6

Colors in Binary (RGB)

Every color on your screen is made from Red, Green, and Blue light. Each color channel is a number from 0-255 (8 bits of binary)!

R 16 00010000
G 185 10111001
B 129 10000001
#10B981
🌈 Color Math
With 8 bits per channel (R, G, B), you get 256 × 256 × 256 = 16,777,216 possible colors! That's why it's called "24-bit color" (8 + 8 + 8 = 24 bits).
7

Meet Hexadecimal

Writing 11111111 every time is tedious! Hexadecimal (hex) is a shortcut - it groups 4 bits into a single character. Instead of 16 symbols (0-15), we use 0-9 and A-F.

The 16 Hex Digits
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
A101010
B101111
C110012
D110113
E111014
F111115
8 Bits = 2 Hex Digits

Click the bits to see how they group into hex!

0
0
0
0
0
0
0
0
0
0
Binary: 00000000 = Hex: 00 = Decimal: 0
Color Codes Decoded

Now you know what #FF0000 really means!

#
FF 11111111 255 Red
00 00000000 0 Green
00 00000000 0 Blue
#00FF00
#0000FF
#FFFF00
#FF00FF
#00FFFF
#FFFFFF
💻 Why Programmers Love Hex
Memory addresses, color codes, and debug info all use hex because it's compact AND maps perfectly to binary. One hex digit = exactly 4 bits. Two hex digits = exactly 1 byte (8 bits). No messy conversions needed!

You Speak Binary!

You've learned how computers use just two digits - 0 and 1 - to represent everything from numbers to text to colors!

0
Bits Toggled
0
Conversions
0
Time Exploring

Binary Basics

Computers use 0 and 1 because circuits are either OFF or ON

Place Values

Each binary position is worth 2x more (1, 2, 4, 8, 16...)

Text Encoding

Letters are stored as numbers using ASCII (A = 65)

Hexadecimal

A shortcut where 4 bits = 1 hex digit (0-F), making FF = 255

Ready to Create?

Put your new knowledge into practice!

Suggest a Correction