A byte is 8 bits.
In computer science we use the base-2 system. Which means we can only use two digits (0 and 1, also called binary) to represent all numbers and data.
In binary, each position represents a power of 2, starting from the rightmost bit (2⁰) and increasing as we move left.
Let's take the binary number 00001011 (row 3) as an example to demonstrate how each position represents a power of 2.
This table shows:
- Each bit's position (7 to 0)
- The power of 2 for each position
- The decimal value of each position
- The actual bit (0 or 1)
- The calculation when bit is 1 (value × bit)
You don't count when a bit is off (0). In compsci you typically start counting from 0. That's why the right most position (n) is a 0 not a 1. (zero-based indexing)