Skip to main content
SparkCore

Clean up your media library without losing files

Reuse and compression reduce the footprint of years of uploads, safely and reversibly where the plugin supports it.

No panic backup

Work on staging first; Spark fits professional workflows.

Why your media library is getting out of control

Most WordPress sites accumulate media for years without cleaning up. Every upload automatically generates multiple thumbnail formats, old page builders leave behind loose exports, and the same image sometimes gets re-uploaded two or three times under a different name. The result: a media library that's much larger than what visitors actually see, leading to higher backup costs and a slower dashboard.

Step-by-step plan: cleaning up your library in practice

Create a backup and test on staging first

Create a full backup before you delete or compress anything, and test your approach on a staging environment first. This way you can always go back to the original state.

Map out your library

Check how many files you have, what the total storage is, and which images are the largest. Large, unused files usually provide the fastest gains.

Delete only what's truly unused

Check that a file isn't embedded somewhere else, such as in a widget, PDF, or email template, before you delete it. When in doubt, compress instead of delete.

Compress and convert what remains

Choose a compression profile per file type and convert to WebP or AVIF where possible. In our tests, optimized files were up to 94% smaller than the original; the exact result depends on the source file.

Process in batches and verify the results

Process a large library in phases rather than all at once, then spot-check to make sure images still look good.

Comparing formats: what you compress into what

Not every format is the best choice for every situation. Here's a quick overview:
FormatTypical savings compared to originalWhen to use
AVIFOften the smallest files; up to 94% smaller than the original in our tests.Modern browsers, photos with lots of detail.
WebPSignificant savings with broad support; typically 25 to 50 percent smaller than a comparable JPEG.Wide fallback option if you're not fully switching to AVIF yet.
JPEG (optimized)Smaller gains than AVIF or WebP, but universally compatible.Legacy systems, email attachments, print preparation.
PNGCompression helps, conversion doesn't always; PNG remains necessary for transparency.Logos, icons, screenshots with sharp text.

Common mistakes when cleaning up

  • Deleting files that are still embedded somewhere, resulting in broken images.
  • Not creating a backup before starting a large cleanup operation.
  • Working directly on the production environment instead of testing on staging first.
  • Setting compression quality too aggressively without visually checking the images.
  • Not clearing the cache after a batch run, so visitors still see old files.
  • Leaving old, unused thumbnail formats from a previous theme behind.

Frequently asked questions

No, not if you follow the steps in this guide. Compression changes a file, it doesn't delete it. Only files you deliberately delete will disappear. For safety, always test on staging first.

You don't have to, and with a large library, it's often not practical either. Batch processing, rolled out gradually in the background, is safer and puts less strain on your server than doing everything at once.

You can, but the gains are usually minimal. Double compression adds little and can result in noticeable quality loss if the settings are too aggressive.

Spark Media Optimizer works with safe copies and accounts for rollback, so if you're unsure, you can always revert to the original state.

Compare the total storage of your media library before and after the cleanup, and check your page speed with a tool like Lighthouse or PageSpeed Insights.

Yes, the same approach applies to web shops. For shop-specific considerations, see our page on optimizing WooCommerce images.