Binary and Decimal: A Beginner's Guide
Every digital device you use stores and processes information using binary numbers. Your photos, messages, documents and videos all exist inside your computer as patterns of ones and zeros. Understanding binary is not just for programmers — it helps anyone working in computing, electronics, networking or digital systems.
Number Systems: Counting in Different Bases
| System | Base | Digits used |
|---|---|---|
| Decimal | Base 10 | 0 through 9. The system everyone uses every day. |
| Binary | Base 2 | 0 and 1 only. The native language of computers. |
| Hexadecimal | Base 16 | 0–9 and A–F. Common in programming. |
| Octal | Base 8 | 0 through 7. Used in some computing contexts. |
How Decimal Numbers Work
In decimal, each position represents a power of 10. The number 347: 3 × 100 = 300, 4 × 10 = 40, 7 × 1 = 7. Total = 347.
How Binary Numbers Work
Binary uses the same positional logic but each position represents a power of 2 instead of 10.
Example: Convert 1011 (Binary) to Decimal
Starting from the right:
1 × 2⁰ = 1
1 × 2¹ = 2
0 × 2² = 0
1 × 2³ = 8
Total = 8 + 0 + 2 + 1 = 11 in decimal.
How to Convert Decimal to Binary
The standard method is repeated division by 2. Divide the number by 2, record the remainder and repeat until the quotient is zero. Read the remainders from bottom to top.
Example: Convert 25 to Binary
25 ÷ 2 = 12 remainder 1
12 ÷ 2 = 6 remainder 0
6 ÷ 2 = 3 remainder 0
3 ÷ 2 = 1 remainder 1
1 ÷ 2 = 0 remainder 1
Read remainders from bottom to top: 11001
Check: 16 + 8 + 0 + 0 + 1 = 25. Correct.
Common Binary to Decimal Reference
| Decimal | Binary | Hexadecimal |
|---|---|---|
| 0 | 0000 | 0 |
| 1 | 0001 | 1 |
| 4 | 0100 | 4 |
| 8 | 1000 | 8 |
| 10 | 1010 | A |
| 15 | 1111 | F |
| 16 | 10000 | 10 |
What Is Hexadecimal and Why Do Programmers Use It?
Hexadecimal (hex) is base 16. It uses digits 0–9 and A–F. A single hex digit represents exactly four binary digits, making it a compact shorthand for binary.
Example: Hex to Binary (F3)
F in hex = 1111 in binary
3 in hex = 0011 in binary
F3 = 11110011 in binary
Without hex, a memory address like FF3A would be 1111111100111010 in binary. Hex is far easier to read and write.
Binary Arithmetic
Adding binary numbers follows the same logic as decimal, but you carry at 2 instead of 10.
| Operation | Result |
|---|---|
| 0 + 0 | 0 |
| 0 + 1 | 1 |
| 1 + 1 | 0, carry 1 |
| 1 + 1 + 1 (with carry) | 1, carry 1 |
Use the Binary Arithmetic Calculator for addition, subtraction, multiplication and division in binary. Use the Hex Arithmetic Calculator for hexadecimal operations.
Where Binary and Hex Appear in Real Life
- Colour codes in web design — the colour red in HTML is FF0000 in hex
- IP addresses and MAC addresses in computer networking
- Memory addresses in programming and debugging
- Assembly language and machine code in software development
- Data storage — one byte = 8 bits = two hex digits
Frequently Asked Questions
Why do computers use binary and not decimal?
Computers are built from electronic switches that are either on (1) or off (0). Binary maps perfectly to this two-state physical reality. Representing ten different states reliably in hardware is far more complex and error-prone than representing two.
How do I quickly convert a small binary number to decimal?
Write out the powers of 2 from right to left (1, 2, 4, 8, 16...) and add up the values where there is a 1 in the binary number. For 1011: 1 + 2 + 0 + 8 = 11.
What does a byte mean in binary?
A byte is 8 binary digits (bits). It can represent 256 different values (0 to 255 in decimal, or 00 to FF in hex). A byte is the standard unit for measuring file sizes and memory — one character of text typically takes one byte.
Is hexadecimal the same as base 16?
Yes. Hexadecimal is simply another name for base 16. It uses 16 symbols: the digits 0–9 for values zero to nine, and the letters A–F for values ten to fifteen. Programmers prefer it because it maps cleanly onto binary: one hex digit = four binary digits (a nibble).
