If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

## AP®︎/College Computer Science Principles

### Course: AP®︎/College Computer Science Principles>Unit 1

Lesson 1: Bits and bytes

# Bytes

A bit is the smallest piece of information in a computer, a single value storing either $\mathtt{\text{0}}$ or $\mathtt{\text{1}}$.
A byte is a unit of digital information that consists of $8$ of those bits.
Here's a single byte of information:
$\mathtt{\text{11110110}}$
Here are three more bytes of information:
$\mathtt{\text{0}}\mathtt{\text{0}}\mathtt{\text{0}}\mathtt{\text{0}}\mathtt{\text{1010}}\phantom{\rule{0.167em}{0ex}}\mathtt{\text{0}}\mathtt{\text{101010}}\mathtt{\text{0}}\phantom{\rule{0.167em}{0ex}}\mathtt{\text{11011011}}$

### From bits to bytes

Conversion between bits and bytes is a simple calculation: divide by $8$ to convert from bits to bytes or multiply by $8$ to convert from bytes to bits. Try it yourself!
How many bytes long is this binary sequence?
$\mathtt{\text{101110}}\mathtt{\text{01}}\mathtt{\text{11011011}}\mathtt{\text{011010}}\mathtt{\text{01}}\mathtt{\text{0}}\mathtt{\text{0110101}}\mathtt{\text{01111111}}$

How many bits are in $8$ bytes of information?

### Why bytes?

What is so special about $8$ bits that it deserves its own name?
Computers do process all data as bits, but they prefer to process bits in byte-sized groupings. Or to put it another way: a byte is how much a computer likes to "bite" at once.
The byte is also the smallest addressable unit of memory in most modern computers. A computer with byte-addressable memory can not store an individual piece of data that is smaller than a byte.

### What's in a byte?

A byte represents different types of information depending on the context. It might represent a number, a letter, or a program instruction. It might even represent part of an audio recording or a pixel in an image.
We'll explore how computers can use bits and bytes to represent all types of information in this unit.