Find and remove duplicate images in WordPress, step by step

How to Find and Remove Duplicate Images in WordPress

Updated 13 October 2026.

Short answer: before you delete anything, back up. Then use a tool that compares file content (a hash), not filenames, to find byte-identical copies. Remove only the copies that aren’t used anywhere on the site, and send them to a recoverable trash rather than deleting them outright. Don’t delete WordPress’s auto-generated thumbnail sizes (files like photo-300x200.jpg). Those are variations, not duplicates.

Duplicates vs thumbnail sizes: check this first

Each time you upload an image, WordPress generates several resized versions (thumbnail, medium, large, plus whatever sizes your theme adds). Many guides that say “duplicate images” are really talking about these unused variations. They aren’t the same problem:

  True duplicate Thumbnail size / variation Edited or resized copy
What it is The same file uploaded twice or more A size WordPress generated from one upload A cropped, resized or re-exported version
Separate Media Library item? Yes No (part of the original’s attachment) Yes
Typical filename logo.png, logo-1.png, or an unrelated name logo-150x150.png Anything
How to find it Hash comparison (MD5/SHA-256) A variation cleanup tool Visual/perceptual comparison, then manual review
Safe to remove? Only copies that nothing uses Only sizes your theme no longer uses Review by hand. It’s a different file

This guide covers true duplicates: the same file sitting in your Media Library more than once.

How duplicates end up in your Media Library

  • Re-uploading a file that someone couldn’t find, often under a new name.
  • Several editors uploading the same logo or banner for different pages.
  • Imports and migrations that don’t check whether a file already exists.

Each duplicate upload also gets its own set of generated sizes, so every extra copy multiplies the wasted storage and makes backups larger.

Method 1: Spot duplicates manually (small libraries)

  1. Open Media → Library and switch to list view.
  2. Search for common patterns: -1, -2, copy, final.
  3. Open suspected pairs and compare dimensions and file size in the attachment details.

The limitation: renamed duplicates slip through, and past a few hundred files this stops being practical.

Method 2: Find exact duplicates with a hash scan (free)

A hash is a fingerprint of a file’s bytes. Two files with the same hash are identical, whatever their names. Media Purge is a free plugin that does this with MD5:

  1. Install Media Purge from Plugins → Add New and activate it.
  2. Go to Media → Media Purge and click Run Scan Now. The scan is read-only and runs in the background in small batches.
  3. Open the duplicates view. Byte-identical files are grouped together, with the storage each group wastes.
  4. For each copy, check where it’s used. Every file in the scanner shows a Used In list with links to the posts that reference it, including Elementor layouts, WooCommerce galleries, widgets and Customizer settings.
  5. Keep the copy your content uses. Trash only the copies the scanner reports as unused.
  6. Check the pages you care about. If something is missing, restore it in one click from the Recovery tab. Trashed files stay recoverable for 30 days by default (adjustable).

What it doesn’t do yet: Media Purge detects and groups duplicates, but it doesn’t merge them. One-click merge (keep one copy, update references, remove the rest) is planned. If two copies are both in use, either swap the image in one post by hand first, or leave both. Resized and edited copies aren’t flagged as duplicates.

Safe removal checklist

  • Take a full backup (files and database) first.
  • Remove only copies with no references. Never delete the copy a page actually displays.
  • Work in small batches, then check key pages, product pages and builder layouts.
  • Clear your page cache or CDN after the cleanup.
  • Delete permanently only after the site has run fine for a while. Until then, keep files in the trash.

Duplicates are usually only part of the clutter. To deal with files nothing uses at all, see how to find unused images in WordPress. For the full process, read the WordPress media library cleanup guide. Comparing tools? See Media Purge vs Media Cleaner.

Exact duplicates vs near-duplicates

An exact duplicate is the same file bytes uploaded more than once (often under a new name). A hash scan finds those. A near-duplicate is a similar picture that is not byte-identical: a recompress, a crop, a re-export, or a slightly different edit. Hash tools will not group those together.

Media Purge’s free duplicates view is built for exact matches (MD5). If you need “looks the same” matching, that is a different product category (perceptual / visual similarity). Treat near-duplicates as a manual review: open both files, decide whether the site still needs both, and only remove a copy after you confirm nothing important uses it.

When both copies are used: pick a keeper and repoint

One-click merge (keep one file, update every reference, trash the rest) is planned for Media Purge and is not available yet. Until then, if the scanner shows both copies in use:

  1. Pick a keeper — usually the copy that appears on the most important pages, or the oldest attachment if usage is equal.
  2. On each page that still points at the other copy, swap the image to the keeper in the editor (or in the page builder).
  3. Re-run or refresh the Used In list. When the non-keeper shows no references, trash that unused copy.
  4. Spot-check the pages you changed. If something is missing, restore from Recovery.

Other WordPress.org tools also target exact duplicates. For example, Media Deduper (about 9,000+ active installs, 3.8★ from 44 ratings, v1.5.9 — figures from WordPress.org, checked October 2026) focuses on duplicate detection and related workflows. Compare features on their listing; do not treat install counts as a ranking of quality.

Staging and batch verify (before you trash much)

  • Prefer a staging copy of the site when the library is large or the shop is live.
  • Work in small batches (for example 10–50 files), then check key templates, product pages, and builder layouts.
  • After each batch: clear page cache / CDN, reload a sample of URLs, and only then continue.
  • Leave files in recoverable trash for a cooling-off period before any permanent delete.

FAQ

Does WordPress create duplicate images automatically?

No. It creates resized versions of each upload, which aren’t duplicates. True duplicates come from uploading the same file more than once.

Can I find duplicates that have different filenames?

Yes, with a hash-based scan. Media Purge groups byte-identical files regardless of filename.

Will removing a duplicate break my pages?

It can, if the copy you remove is the one a page uses. Check the Used In list, trash only unused copies, and keep a backup. In Media Purge, trashed files can be restored from the Recovery tab.

Does Media Purge merge duplicates?

Not yet. Detection is free today, and one-click merge is planned for a future release.

Is there a limit on how many files it scans?

No. The free version has no scan caps and no file-count limits.

How do I handle duplicates after a migration or import?

Migrations and XML/CSV imports often re-upload the same assets. Run an exact-hash scan after the import settles, verify Used In on each group, and trash only unused copies. If both copies are wired into content, repoint to one keeper first (see above). Do not delete generated -300x200-style sizes thinking they are duplicates.

What about WooCommerce product image duplicates?

Product galleries, variation images, and category thumbnails can each hold a different attachment ID for the same bytes. Always read the Used In list (including WooCommerce galleries) before trashing. If two gallery entries point at two duplicate files, switch both to the keeper in the product editor, then trash the unused attachment. For a full product-image cleanup, see how to delete unused WooCommerce product images safely.

Used Media Purge for this?

Share what worked, or what didn’t, in a quick WordPress.org review. It helps other site owners find a safe cleanup tool.

Review Media Purge

Leave a Comment

Your email address will not be published. Required fields are marked *

Prove your humanity: 4   +   8   =