# Byte

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

**Field:** Software Development  
**Category:** Programming Concepts  
**Also known as:** Bit, Kilobyte, Megabyte, Gigabyte, KB, MB, GB

## 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.

## 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

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

## Example code

```python
print(len("Hello".encode()))
# 5
```

Five plain letters take five bytes.

## Why it matters

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

## Common mistake

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

## Three principles

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

## Related terms

- [Data Type](https://learn.benibix.com/term/development/data-type)
- [Integer](https://learn.benibix.com/term/development/integer)
- [String](https://learn.benibix.com/term/development/string)
- [Variable](https://learn.benibix.com/term/development/variable)

## Taught in

- [Data Types in Python](https://learn.benibix.com/learn/development-concepts/data-types-in-python): Programming Basics, 6/18

---

Source: https://learn.benibix.com/term/development/byte
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
