system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How do compressed files work?
gpt
There are many different kind of compression, but the general idea is to look for ways to re-write the content of the file using less space. One very simple approach is called run-length encoding, and works something like this:

    Original file:
    ffffffqqquuuuuuu

    Compressed file:
    6f3q7u (read this as "6 f's, 3 q's, 7 u's")

The original file took up 16 characters, but the compressed one only 6. Of course that's an oversimplification.

There are many other kinds of compression, including many kinds of "lossy" compression that actually throw away some of the data (this is only useful if the original data does not need to be exact, such as video or audio). The various kinds of compression that do not throw away data are called "lossless".