Everything Is Bits: Binary, Hex, and the Limits of Representation
🎒 with Byte
Byte, a friendly robot guide with a glowing chest panel, stands beside a giant glass tube where photos, song waves, and letters all dissolve into cascading streams of flickering 0s and 1s flowing steadily downward.
Convert whole numbers between binary, decimal, and hexadecimal representations.
Explain how text, images, and sound are encoded as binary using standard schemes like ASCII, Unicode, RGB, and samples.
Calculate how many distinct values a fixed number of bits can represent (2^n).
Describe at least two consequences of finite representation, such as overflow and rounding error.
Key terms
Bit
The smallest unit of data, a single binary digit that is either 0 or 1.
Hexadecimal
A base-16 notation where each digit maps to exactly four binary bits.
Unicode
A character-encoding standard assigning a unique number to every world script and emoji.
Sampling
Measuring a sound wave's amplitude many times per second to store it digitally.
Overflow
When a value exceeds the maximum a fixed bit-width can hold and wraps around.
Positional Number Systems
Binary, decimal, and hexadecimal are all positional systems where a digit's value depends on its place. In binary each place doubles, giving weights 1, 2, 4, 8, 16, and so on, so 1011 equals 8 + 2 + 1 = 11. Hexadecimal groups four bits into one digit because 2⁴ = 16, making long binary strings far easier for humans to read and compare. Conversion is mechanical: write the place values, mark which positions are on, and sum them. The same value can be written in any base; only the notation changes, never the underlying bits.
Finite Representation Has Consequences
Because storage is finite, n bits encode exactly 2ⁿ distinct values and no more. An unsigned 8-bit register counts 0 to 255; adding one to 255 overflows and wraps to 0. Real numbers face a related limit: fractions like 1/3 or 0.1 cannot be stored exactly in finite binary, so they are rounded, introducing tiny errors that accumulate over many operations. Skilled programmers anticipate these limits, choosing bit widths large enough to avoid overflow and using tolerance comparisons rather than exact equality when working with floating-point values.
Worked examples
Convert the binary number 1011 to decimal and to hexadecimal.
Write the 4-bit place values from left to right: 8, 4, 2, 1.
Mark which positions are on: 1011 means 8 is on, 4 is off, 2 is on, 1 is on.
Sum the on positions for decimal: 8 + 0 + 2 + 1 = 11.
For hex, map the 4-bit group directly: decimal 11 is the hex digit B.
Answer: 1011 in binary equals 11 in decimal and B in hexadecimal.
Hi, I'm Byte. Inside every computer there is really only one kind of thing: a switch that is either OFF or ON. We write OFF as 0 and ON as 1, and each switch is called a bit. Eight bits make a byte. That's it. Everything else — photos, songs, your homework — is just clever ways of arranging those 0s and 1s.
Numbers come first. In our normal decimal system each place is worth ten times the one to its right. Binary works the same way but with two: places are worth 1, 2, 4, 8, 16, and so on. So 1011 means 8 + 0 + 2 + 1 = 11. Because long binary strings are hard for humans to read, we group bits and use hexadecimal (base 16), where digits run 0–9 then A–F. Four bits map to exactly one hex digit, so 1011 is hex B.
Text uses an agreed code so every machine reads the same letters. ASCII gives each character a number (capital A is 65); Unicode extends this to cover emoji and every world script. Images are grids of pixels, and each pixel stores red, green, and blue brightness values, usually 0–255 each. Sound is captured by measuring the wave's height thousands of times per second — called sampling — and storing each measurement as a number.
Here is the catch: representation is finite. With n bits you only get 2^n different values, full stop. Eight bits can count 0 to 255, no higher. Push past the top and you get overflow, where the number wraps around. Try to store a value like 1/3 and you must round it, creating tiny errors that can add up. Finite bits mean finite precision, and good programmers always plan for that limit.
If you get stuck: for binary-to-decimal or hex conversion, write out the place values (8 4 2 1 for 4-bit; 128 64 32 16 8 4 2 1 for 8-bit) and mark which positions are ON. For hex digits above 9, remember A=10, B=11, C=12, D=13, E=14, F=15. For encoding questions, ask yourself what agreed-upon table maps symbols to numbers. For overflow or 2^n questions, count the bits and raise 2 to that power.
Activity
Order these 4-bit binary numbers from smallest to largest value
Practice
Convert the 8-bit binary number 11001010 into its decimal value.
How many distinct values can a 10-bit field represent, and why?
Common mistakes to avoid
Hex stores different data than binaryHexadecimal is only a compact notation for the same bits the computer stores in binary.
Binary cannot represent large numbersBinary represents any size given enough bits; overflow comes from fixed width, not binary itself.
Check your understanding
What is the binary number 1011 in decimal?
A pixel stores its color using one byte (8 bits) per channel for red, green, and blue. How many distinct levels can ONE channel represent?
Why does an unsigned 8-bit counter 'wrap around' to 0 after reaching 255?
Which statement about hexadecimal is correct?
Recap
Everything in a computer is bits arranged by clever schemes: positional notation handles numbers, ASCII and Unicode handle text, RGB handles images, and sampling handles sound. Finite bit widths cap the representable range, producing overflow and rounding error.
Reflect
Where might a hidden rounding or overflow error cause a real bug in software you use?