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.

Main content

Bits (binary digits)

AP.CSP:
DAT‑1 (EU)
,
DAT‑1.A (LO)
,
DAT‑1.A.2 (EK)
,
DAT‑1.A.3 (EK)
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
Check your understanding
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?
Choose all answers that apply:
Choose all answers that apply:

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
Check your understanding
How many different values can four bits represent?
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

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?