Skip to content
BENIBIX Learn

Byte

Development🧩 Programming ConceptsData and Variables

Also known as Bit, Kilobyte, Megabyte, Gigabyte, KB, MB, GB

A group of 8 bits, each a 0 or 1. Computers count size in bytes.

Think of it like

Think of it like a row of eight light switches. Each one is on or off, and the row together means one thing.

Example

Lucy saves the word "Hello" in a plain text file. The file is 5 bytes, one for each letter.

Why it matters

Bytes are how size is measured: files, memory, downloads and storage. Every limit you meet is in bytes.

Definition

A byte is a group of 8 bits, and a bit is a single 0 or 1. One byte can hold 256 different patterns, enough for one letter like A. File sizes and memory are counted in bytes. A kilobyte is about a thousand bytes and a megabyte about a million. A short text message fits in a few hundred bytes; a photo takes a few million.

Example code

python
print(len("Hello".encode()))
# 5
Five plain letters take five bytes.

Common mistake

Mixing up bits and bytes. Internet speeds are given in bits, so 8 megabits a second is only 1 megabyte.

Key takeaways

  1. 1
    Eight bits. Each bit is a 0 or a 1.
  2. 2
    256 patterns. One byte can mean 256 different things.
  3. 3
    The unit of size. Files and memory are counted in bytes.

Learn it properly