What is a Bit?
A bit is the smallest piece of information that a computer can store and work with. The name “bit” is short for “binary digit”. That’s because a bit can only be a 0 or a 1 – it’s binary! Bits are like the atoms that make up all the data inside a computer.
How Bits Work
A single bit on its own doesn’t mean much. But when you string a bunch of bits together, you can make numbers, letters, colors, sounds, and everything else a computer needs to run programs and show stuff on the screen.
It takes 8 bits to make one “byte”. A byte can store a single character, like the letter “A” or a dollar sign “$”. More bits together can store bigger things. Two bytes (16 bits) can be put together to store a number between 0 and 65,535. Four bytes (32 bits) can store a number up to about 4 billion!
Where You Find Bits
Bits are everywhere inside a computer or phone. When you save a document, snap a pic, or download a movie, all that data gets stored as huge collections of bits. These bits gets saved to the hard drive or flash storage.
When the CPU (the “brain” of the computer) wants to work on some data, it pulls the bits in from storage and copies them to the RAM. The RAM is super-fast memory right next to the CPU. Programs also get copied there while they’re running.
Even the CPU itself runs on bits! It has special places inside called “registers” that can hold 32 or 64 bits at a time while it does math on them. The results then get stored back to RAM as more bits.
Bits in Coding and Files
Binary Numbers
Since bits are just 1’s and 0’s, you can think of them as binary numbers. Each 1 or 0 is one “place” in the number, just like each digit in a regular base-10 number.
The places in a binary number represent powers of 2, from right to left. The rightmost bit is the 1’s place (2^0), then the 2’s place (2^1), then the 4’s place (2^2), the 8’s place (2^3), and so on.
For example, the binary number 1010 represents (1 * 8) + (0 * 4) + (1 * 2) + (0 * 1) = 10 in decimal.
Text, Images and Other Files
Letters and symbols are represented as bits using encodings like ASCII and Unicode. Each letter gets a unique number. For example, uppercase “A” is number 65. In bits that looks like 01000001.
Image files store the color of each pixel using bits. In a 24-bit “true color” image, each pixel’s color gets 24 bits – 8 bits for the amount of red, 8 for green, and 8 for blue. More bits per pixel means more possible colors.
Sound files work similarly. The sound wave gets measured thousands of times per second, and each measurement is stored as 16 or 24 bits. More bits means you can store more detail in the sound.
Bits in Programs
The code of programs is also made of bits. Each command the CPU understands has a unique number. So a program is like a big string of these numbers, telling the CPU what to do step-by-step. When you run a program, the computer loads these bits from storage and decodes them to run each command.
Sending Bits
Bits are not just for storing data – they’re also how computers talk to each other! When your phone sends a Snapchat, or your laptop streams a YouTube video, it’s sending huge streams of bits over the internet.
Bitrate
The speed of a network link is called the “bitrate” – how many bits it can send per second. Your home WiFi might be 100 megabits per second (Mbps). That means in one second, your router can send 100 million bits to your device!
Big downloads and high quality video streams need a lot of bits, so they need a fast connection. A slower link is fine for simple stuff like website text, since there’s less bits to send.
Bytes vs. Bits
Network speeds are always measured in bits, but file sizes are usually measured in bytes. This difference trips people up a lot!
For example, let’s say you want to download a 10 megabyte (MB) file over a 10 megabit per second (Mbps) link.
10 MB = 10 x 1,000,000 bytes = 80,000,000 bits 10 Mbps = 10 x 1,000,000 bits per second
To download 80,000,000 bits at 10,000,000 bits per second will take 8 seconds. The math is pretty easy once you know 1 byte = 8 bits!