system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: File Compression

Like zip files. It seems odd to me that you can reduce a file to a smaller one and then get it all back.
gpt
Imagine you have a list of names you're trying to remember:

    Mary Mary Mary Dave Mary Mary Mary Mary Dave Mary Mary Mary Mary Dave Mary Fred

You could memorize each word (or even each letter and space) in order, but there are lots of ways to organize the data to make it easier for yourself. The first thing you notice is that there is a lot of repetition. You might try to think of the list like this:

    Mary(×3) Dave Mary(×4) Dave Mary(×4) Dave Mary Fred

You've reduced it from a list of 16 items (each name) to one of 11 (each name plus the repetition notes). We can even reduce it further. You notice that this pattern appears three times:

    Mary Mary Mary Dave Mary

So let's define this:

    A = Mary(×3) Dave Mary

Our list now becomes:

    A(×3) Fred

Depending on how you want to count, that's about 8 or 9 things to keep track of. We've cut what we have to remember in half, and yet we haven't lost any of the original data! As long as we know what method we used to make our shorthand list, it's easy to take it and expand it back into the original list.

File compression on computers works in a similar way. A computer uses a little program (called a utility) to compress the data. The utility has an algorithm (a method of processing the data) that looks for patterns and shortcuts in the binary code. (We were concerned with discrete words above, but the utility analyzes the string of 1s and 0s that actually make up a file.) The more sophisticated the algorithm, the smaller the compressed file can be. (It also helps if there are lots of patterns or repetition for the algorithm to latch onto. Certain files compress better than others because of this.) To decompress the data, a companion utility reverses the process.