What is a bit?
At the lowest level, computers store everything as bits. A bit is just a switch that is either 0 (off) or 1 (on).
By itself, a single bit does not mean much. But when you put many bits together and agree on a meaning, you can store numbers, letters, sounds, and pictures. The agreement is called an encoding.
Simple definition: A bit is a 0 or a 1. An encoding tells the computer what those 0s and 1s represent.
Try it: Binary Explorer
Below is the same kind of tool that powers the CodeHS Bit Explorer PowerUp. The encoding is simple: 0 means white and 1 means black. The bits are read from left to right, top to bottom, just like the words on this page.
| Key | Value |
|---|
Challenge 1
Can you draw a simple 5×5 letter?
Challenge 2
Switch to hex mode and compare the length.
Challenge 3
What happens if rows and columns do not match the data?
Resolution and shape
The rows and columns settings control how the bit string is wrapped into a grid. If you have 64 bits and set the grid to 8×8, you get a square picture. If you set it to 4×16, the same bits become a wide rectangle.
This is the same idea behind a digital photo’s resolution. A 1920×1080 image is just a grid that is 1,920 pixels wide and 1,080 pixels tall, with each pixel’s color stored as bits.
Try this: Change the number of rows or columns in the explorer above. The same bit string will look completely different because the computer is wrapping it into a new shape.
Hexadecimal: a shorter way to write binary
Long strings of 1s and 0s are hard for people to read. Hexadecimal (or just hex) is a base-16 number system that lets us write four bits with a single digit.
When you switch the explorer to Hexadecimal, each hex digit expands to four bits. The digit F becomes 1111 (four black squares), and 0 becomes 0000 (four white squares). That is why a single hex digit can describe a tiny 2×2 block of pixels.
| Hex digit | Binary | Pixels |
|---|---|---|
| 0 | 0000 | |
| 5 | 0101 | |
| A | 1010 | |
| F | 1111 |
Why this matters
Everything digital is encoded as bits. Here are a few places the same idea shows up.
- Images: PNG, JPEG, and GIF files store pixel colors as bits, often with clever compression.
- Screens: Your phone or monitor turns bits into the colors you see.
- Fonts: Early computer fonts were simple bit grids just like the ones in this explorer.
- Compression: File formats store patterns of bits more efficiently by finding repetition, just like describing a checkerboard as “black, white, repeat.”
Once you understand that bits are just a code, you can imagine turning any information into 0s and 1s and back again.
Quick quiz
1. In the Binary Explorer, what does the digit 1 represent?
2. What happens when you increase the number of rows and columns?
3. Why is hexadecimal useful when working with binary data?
Keep exploring data and computers
Now that you know how bits become pictures, you can explore how computers store numbers, text, and sound, or keep going with more CodeHS tutorials.
Part of the Bits & Bytes tutorial series.