Lossless compression repacks data more efficiently while keeping every bit recoverable. It works by spotting repetition: a run of identical values becomes a count, common patterns get short codes, and predictable data gets predicted. ZIP archives, PNG images and FLAC music are lossless. Text files often shrink to a fifth of their size because language is full of repeated patterns. The limit is real though: already random or already compressed data has no repetition left to exploit, which is why zipping a JPEG photo or an MP4 video saves almost nothing. Lossless is the only acceptable choice for documents, code, backups and anything you may need to edit or verify later.
Lossy compression goes much further by permanently discarding information judged unimportant. JPEG throws away fine colour detail the eye barely registers. MP3 and AAC discard sounds masked by louder ones. Video codecs keep only the differences between frames plus a simplified version of each frame. The rewards are large: a photo that is 30 MB raw can be a good looking 3 MB JPEG, a ratio of 10 to 1 that lossless cannot approach. The costs are permanent and they accumulate: re-saving a JPEG as a JPEG degrades it again each generation. Keep an untouched original of anything precious, and treat lossy files as the copies you share, not the masters you keep.
The compression ratio tells you which family you are looking at. Ratios under about 2 to 1 on media files suggest lossless or very gentle lossy settings. Ratios of 10 to 1 and beyond mean serious information loss, fine for a web image, wrong for an archive. For mixed backups, expect text and documents to compress well, photos and videos barely at all, so the overall ratio mostly reflects the mix. The ratio calculator on this site lets you test real before and after sizes from your own files, which beats any rule of thumb: compress a sample folder, read the ratio, and scale it up to the whole job before committing hours to it. There is a middle path worth knowing for photographs and audio you care about: keep one lossless master and generate lossy copies for each use, sized for that use. A phone copy, a web copy and a print copy can all descend from the same untouched original. Storage keeps getting cheaper while moments stay unrepeatable, which settles most arguments. When in doubt, keep the master. You can always throw information away later; you can never invent it back.