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.

## Computers and the Internet

### Course: Computers and the Internet>Unit 1

Lesson 1: Bits and bytes

# Bits (binary digits)

Computers store information using bits. A bit (short for "binary digit") stores either the value start text, 0, end text or start text, 1, end text.

## 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?
StateBit
A lightbulb that's off
start text, 0, end text
A lightbulb that's on
start text, 1, end text
Is a button enabled or disabled?
StateBit
An enabled button that says "Submit"
start text, 0, end text
A disabled button that says "Submit"
start text, 1, end text
Is the current time AM or PM?
StateBit
An alarm clock that says "9:35 AM"
start text, 0, end text
An alarm clock that says "9:35 PM"
start text, 1, end text
Consider this settings screen for a Khan Academy user:
Screenshot of Khan Academy account setting screen with four settings: User name (a text field with the string "foxhound"), Birthdate (a date field with 7/10/1981), Primary language (a dropdown with "English" selected), Sound effects (a checked checkbox).
Which of the settings can be stored in a single 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, squared) distinct values:
start text, 0, end text, start text, 0, end text, start text, 0, end text, start text, 1, end text, start text, 10, end text, start text, 11, end text
A sequence of three bits can represent eight (2, cubed) different values:
start text, 0, end text, start text, 0, end text, start text, 0, end text, start text, 0, end text, start text, 0, end text, start text, 1, end text, start text, 0, end text, start text, 10, end text, start text, 0, end text, start text, 11, end text, start text, 10, end text, start text, 0, end text, start text, 101, end text, start text, 110, end text, start text, 111, end text
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 start text, 10, end text, start text, 0, end text, start text, 0, end text, start text, 0, end text, start text, 11, end text 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
How many different values can four bits represent?

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

## Want to join the conversation?

• How does the computer know whether a binary pattern results in the display of a letter or number?
• 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.
• I didn't understand how 4 bits can represent 16 values.Could you please explain.Thanks
• 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.
• "At , what are electromechanical transistors?"
• it focuses on the interaction of electrical and mechanical systems as a whole and how the two systems interact with eachother.
• How does a computer know how to display this information?
• whenever i see computer specification there written
32 bit
64 bit
128 bit

i always wonder what this means
• 32 bit and 64 bit refer to the addressable memory. A 32 bit computer can only use about 4 GB of RAM, whereas a 64 bit computer can use about 16 exabytes of RAM. 64 bit computers can often do more calculations per second, so they are faster.
• How do just two numbers make up an entire device
• Computers can't understand statements or requests like "Please put the picture of dogs on the top right page of the screen". For computers, it's total gibberish. The best way for computers to understand our requests are by the most simple types of questions possible - YES or NO. 1's and 0's simply respond to the computer asking "Does variable x = y?". So whatever question the computer asks, we can say YES or NO, 1 or 0. These questions can range from anything from "what is this letter" to "where is this item's coordinates". At the end of the day, computers just run on "should I do this", numerous times.