Binary: Bits, Grouping & Powers of Two
Binary: Bits, Grouping & Powers of Two
This page explains the binary numeral system in detail, how to read and write binary numbers, and how to use powers of two for calculation.
Introduction
Binary is the most fundamental numeral system in computing. It uses base 2 with the digits 0 and 1 only. Because computer hardware operates with two states (voltage on/off), binary is a natural choice.
Examples:
- 0₂ = 0₁₀
- 1₂ = 1₁₀
- 10₂ = 2₁₀
- 11₂ = 3₁₀
- 100₂ = 4₁₀
Positional values in binary
Each column (digit) in binary is worth twice the one to its right. This corresponds to powers of 2.
From right to left:
- 2⁰ = 1
- 2¹ = 2
- 2² = 4
- 2³ = 8
- 2⁴ = 16
- 2⁵ = 32
- 2⁶ = 64
- 2⁷ = 128
- and so on.
Example: 110₂ = 1 × 2² + 1 × 2¹ + 0 × 2⁰ = 4 + 2 + 0 = 6₁₀.
Grouping binary digits
Binary numbers grow long quickly. To make them easier to read:
- Group digits in blocks of 4: 1111101000 → 1111 1010 00.
- These groups will later map directly to hexadecimal digits.
- Sometimes 8-bit groups are used to highlight a byte.
Notation
Binary numbers are usually marked with a subscript 2.
- Example: 1011₂ = 11₁₀.
Older sources may add a trailing B instead: 1011B.
How to convert from decimal to binary
Method 1: Powers of two 1. Find the largest power of 2 less than or equal to the decimal number. 2. Subtract it and mark a 1 in that binary position. 3. Repeat with the remainder until 0 is reached.
Example: Convert 23 to binary
- Largest power of 2 ≤ 23 is 16 = 2⁴ → put 1 in 2⁴ column. Remainder: 7.
- Next: 8 = 2³ is too big, so digit = 0.
- Next: 4 = 2² fits → digit = 1. Remainder: 3.
- Next: 2 = 2¹ fits → digit = 1. Remainder: 1.
- Next: 1 = 2⁰ fits → digit = 1. Remainder: 0.
Result: 23₁₀ = 10111₂.
Method 2: Division by 2 1. Divide the number by 2. 2. Record the remainder (0 or 1). 3. Repeat with the quotient until 0. 4. Read the remainders backwards.
Example: Convert 23 to binary 23 ÷ 2 = 11 remainder 1 11 ÷ 2 = 5 remainder 1 5 ÷ 2 = 2 remainder 1 2 ÷ 2 = 1 remainder 0 1 ÷ 2 = 0 remainder 1 Read backwards: 10111₂.
From binary to decimal
Multiply each digit with its positional value (power of 2) and add them.
Example: 100101₂ = 1 × 2⁵ + 0 × 2⁴ + 0 × 2³ + 1 × 2² + 0 × 2¹ + 1 × 2⁰ = 32 + 0 + 0 + 4 + 0 + 1 = 37₁₀.
Binary arithmetic
Binary arithmetic follows the same principles as decimal, but only uses digits 0 and 1.
Addition rules:
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 10 (write 0, carry 1)
Example: 1011₂ + 1101₂
1011
+ 1101 = 11000₂ (24₁₀)
Subtraction rules:
- 0 − 0 = 0
- 1 − 0 = 1
- 1 − 1 = 0
- 0 − 1 = 1 with a borrow from the next higher column
Example: 10010₂ − 1011₂ 10010 (18) − 1011 (11) = 111 (7)
Multiplication: Same as decimal: multiply by each digit and shift left accordingly. Example: 101₂ × 11₂ = 1111₂ (5 × 3 = 15)
Why binary matters
- Binary is the foundation of all digital logic.
- Understanding powers of two is crucial for memory sizes, addresses, and CPU word lengths.
- It is also the basis for octal and hexadecimal systems, which are simply shorthand for binary.