Definition
Lossy compression is a way of shrinking a file by choosing some of the original data and throwing it away. It discards the parts that human eyes and ears barely notice first, so the file gets much smaller while still looking and sounding about the same. The catch is that information you've thrown away can never be brought back.
What We Do When the Suitcase Won't Close
You've probably packed a bag the night before a school trip and found the zipper wouldn't close. So you pull things out one by one and set aside the clothes you're least likely to wear. The bag gets lighter, but the clothes you left behind aren't there when you reach your destination.
Photo and music files run into the same problem. If you keep the original as is, the file is so big that it's hard to send around. So some of the information inside gets picked out and thrown away to make the file smaller.
The key is what gets left out. The method picks the things people are least likely to notice first. Our eyes are sensitive to differences in brightness but not so sharp about tiny differences in color, so photo compression makes the color information coarser first.
Sound works the same way. While a loud sound is ringing out, a quiet sound right next to it is hard to hear. Music compression wipes out those masked sounds completely.
Rolling Clothes Up vs. Leaving Them Out
There are two ways to shrink a bag. One is to roll your T-shirts up tight to save space. Nothing is missing, so when you arrive and unroll them, every piece is right where it should be.
This is called lossless compression. When you unpack the file, it comes back exactly the same as the original, without a single character changed. Documents and program files stop working if even one character is off, so they're shrunk this way.
The other way is to leave some clothes at home. That's lossy compression, and what you leave behind doesn't come back. In return, the amount of space you save is far bigger than with the first method.
That's also why you get to pick a quality level when you save a photo. The lower the quality, the more gets left out, so the file gets smaller. The trade-off is that blotchy marks start to show up in places where color changes smoothly, like a sky.
To Be More Precise
Let's use the suitcase one more time. Say you repack at your destination and leave a few more items behind. By the time you get home, you have far less than you started with.
The same thing happens when you open a lossy photo, edit it a little, and save it again. Each save strips out new information, so the more you repeat it, the worse the quality gets, bit by bit. If you plan to edit a photo, it's smart to keep the original file separate.
The range where this method works is clear, too. It's mainly used for things people take in through their senses, like photos, sound, and video. It only works when there's some slack in what people notice, because that slack is what gives you something to throw away.
It isn't used for text and numbers. If the last digit vanished from a bank balance, that file would be useless.
Common misconceptions
Lossy compression only lowers the quality, and if you change the setting back, you can restore the original file.
The information thrown away during compression isn't stored anywhere in the file. Even if you save again at high quality, the lost parts don't return, and the file just gets bigger.
Lossy compression always makes the quality visibly worse.
You can control how much gets thrown away. There's a sweet spot where you toss just a little, so the result is hard to tell from the original, yet the file shrinks a lot. Most photos and music use that range.
Where you meet it
A photo taken with your smartphone gets saved in a format like JPEG or HEIC, and the file ends up much smaller than the original data.
When you turn on data saver mode in a music app, the sound gets a little fuzzier, but it uses less data.
In one sentence
It shrinks a file a lot by throwing away the parts human eyes and ears miss, and the information you throw away never comes back.