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.

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

## Want to join the conversation?

• What if we have a number of bits that are non-divisible by 8? Is that possible?
• You can always add zeroes to create 8 bit chunks.
• And half a bit is a nibble lol
• Actually a nibble is 4 bits.
• How do quantum computers work with bits and bytes?
• What does it mean when you download software and it asks for 32 or 64 bit/byte file type?
• 32 and 64 are referring to the number of bits that the CPU can use at once. Most modern computers now use 64 bits which allows them to work faster and take advantage of larger amounts of memory. Usually, 32-bit programs will work on a 64-bit machine (though not always). However, 64-bit programs cannot be used on 32-bit machines.
• if bits were a thing you can hold what would it look like?
(1 vote)
• We sort of already have that. Take a coin for example, it could either have heads facing up, or tails. So it has two possible states, which is what a bit is. However, a coin stores a bit, rather than actually being a bit. I don't exactly know what bits themself would look like, since they're really just an idea, rather than an actual object.
• "At , what does the concept of byte-addressable imply? A computer should be able to store an individual piece of information, being made of wires?"
• A byte is a grouping of eight bits. Byte-addressable means that the computer stores data in bytes instead of single bits for example.

Wires are used for transporting information, computers generally don't use them as a storage device.
• why everyone can say AP CS is easy. I obviously saw them really complex-.-
• Took both AP CSA and CSP, got decent scores, throughout my high school.

Relatively, its not really as complex. AP CSP is basically basic programming understanding and what an IT Person would know. You really need to like computers or you will actually get bored in the course, as its really complex.

Additionally, look into youtube for further videos on that. As someone's who studying in a STEM Course, a great way to find time is to actually understand the concept behind everything, from abstract to the physical.
• I know i'm in highschool but my braincells cannot comprehend this use of inexplicit code...(im tired
• Why bytes?Like why is it 8 and not like like 10 wouldn't that make it easier.
• In our base 10 system, 10 is a place value represented by 10^1. In binary, however, it's in base 2, so 8 is a place value represented by 2^3.

It's 8, because 8 is close to our friend 10.
• Is there a limit to the binary number system? MAX values?