Main content

## AP®︎/College Computer Science Principles

# Bits (binary digits)

Computers store information using bits. A $\mathtt{\text{0}}$ or $\mathtt{\text{1}}$ .

**bit**(short for "binary digit") stores either the value## What fits in a bit?

A single bit can only represent two different values. That's not very much, but that's still enough to represent any two-valued state.

**Is a lightbulb on or off?**

State | Bit |
---|---|

**Is a button enabled or disabled?**

State | Bit |
---|---|

**Is the current time AM or PM?**

State | Bit |
---|---|

## Sequences of bits

Computers use multiple bits to represent data that is more complex than a simple on/off value.

A sequence of two bits can represent four (${2}^{2}$ ) distinct values:

A sequence of three bits can represent eight (${2}^{3}$ ) different values:

A sequence can represent many things: a number, a character, a pixel. Plus, the same sequence can represent different types of data in different contexts. The sequence $\mathtt{\text{10}}\mathtt{\text{0}}\mathtt{\text{0}}\mathtt{\text{0}}\mathtt{\text{11}}$ could represent $67$ in a calculator application while also representing the letter "C" in a text file. Learn more in our lessons on Binary numbers and Storing text in binary

## Physical storage

Computers typically store bits using electromechanical transistors which can map electrical signals to either an on or off state. Learn more in our article From electricity to bits or this video on how transistors work.

🙋🏽🙋🏻♀️🙋🏿♂️Do you have any questions about this topic? We'd love to answer— just ask in the questions area below!

## Want to join the conversation?

- How does the computer know whether a binary pattern results in the display of a letter or number?(29 votes)
- You (or the compiler you use) have to explicitly tell the computer how to interpret a bit string.

So when you write code you'd have to specify "This is a character" or "This is a binary number", high level programming language have functions to make that easier.(44 votes)

- Why did they come to learn 1s and 0s? Couldn't they learn our language?(4 votes)
- It's a computer lil bro(27 votes)

- I didn't understand how 4 bits can represent 16 values.Could you please explain.Thanks(8 votes)
- If we have 4 bits and each can be one of two values, then the number of combinations one can make with 4 bits is equal to 2*2*2*2 = 2^4 = 16.(15 votes)

- How does a computer know how to display this information?(9 votes)
- The computer know to display the info because it reads digital info in bits, and then outputs and converts those bits into visible things, like letters.(4 votes)

- "At11:47, what are electromechanical transistors?"(7 votes)
- it focuses on the interaction of electrical and mechanical systems as a whole and how the two systems interact with eachother.(3 votes)

- How would a computer know if 1000011 in a text file represents the number 67 or the letter C?(6 votes)
- It nows has a system in it and it travels as a bit it is converted into it when a computer reads it in 1's and 0's and is converted back into the digital form

hope it helps🙂(8 votes)

- why is this topic so complicated and stressful given the fact that i literally just found out about it today?(8 votes)
- becus copeters are coplcated.(4 votes)

- I dont seem to understand a sequence of bits can anyone explain(5 votes)
- When you have more than one bit (or wire), the number of possible values increases. In 1 bit there are two possible values: 1 or 0. In 2 bits, there are four possible values, or combinations: 00, 01, 10, 11. With each additional bit, the number of possible values/combinations goes up by a factor of two.(6 votes)

- Bits are binary digits (0 and 1)(4 votes)

- should i click for the 'learn more about this lessons' ? are they include for the AP exam?(7 votes)