Skip to content
Tactiverge

Digital logic

Bits and bytes

Also called: bit · byte · nibble · word · how many values

Definition

A bit is a single binary digit, 0 or 1. A byte is 8 bits. n bits can represent 2^n different values.

Picture it

Every extra bit doubles the number of patterns. 8 bits give 256 patterns, enough for 0 to 255 or one character of text. Storage counts in bytes (B); data rates on wires often count in bits per second (bit/s), so divide by 8 to compare.

The maths

number of values = 2^n
largest unsigned value = 2^n − 1
1 byte = 8 bits
SI units used in this entry
QuantityUnitSymbol
informationbitbit
informationbyte (8 bits)B
data ratebit per secondbit/s

Worked example

How many values can 12 bits represent? How long does it take to send 1 kB (1000 bytes) over a 9600 bit/s serial link, ignoring start and stop bits?

  1. 2^12 = 4096 values (0 to 4095)
  2. 1000 bytes × 8 = 8000 bits
  3. 8000 / 9600 = 0.833 s

Answer4096 values; about 0.833 s.

✓ The 2 numbers in this answer are recomputed from scratch by an automated test.

Common misconceptions

  • Misconception: Lowercase b is bits and uppercase B is bytes; 100 Mbit/s is 12.5 MB/s.
  • Misconception: n bits give 2^n values, but the largest is 2^n − 1 because 0 takes a pattern.