Vyso Guides
How to Find and Remove Duplicate Images in WordPress
To find WordPress duplicate images, first separate repeated uploads from image sizes that WordPress generated for one attachment. Then compare the suspected copies, choose the attachment to retain, and replace references to the others before deleting them. A matching thumbnail or filename is a starting clue, not permission to remove a file.
Duplicate images and unused images are different problems. Two identical uploads can both be used on the website. A unique image can have no current use. Deduplication asks which assets repeat; a usage audit asks which references would break if an attachment disappeared.
Identify what is duplicated
A Media Library entry is an attachment record with an ID and associated information. An image attachment can own a main file, smaller generated sizes, and other processing outputs. Counting files in the uploads directory therefore does not tell you how many independent uploads exist.
Repeated uploads can produce separate files with identical bytes, different filenames, and different attachment IDs. But the same picture can also have different bytes after recompression, an embedded-metadata change, a format conversion, or a resized export. The resemblance alone does not tell you which situation you have.
Similar photographs need a separate judgment. Adjacent shots, alternate angles, and small creative changes can serve different purposes. A thumbnail, card crop, or responsive size may instead be a generated derivative of one attachment and still be needed by the site.
Check whether the suspected copies even have separate files. An import or plugin can create several attachment records pointing to the same physical data. Deleting that file could break the record you intended to retain.
WordPress documents its attachment metadata and image-size generation. For practical management of those sizes, use the WordPress image resizing guide. A duplicate-file cleanup should not become an indiscriminate thumbnail cleanup.
Why duplicate images appear in WordPress
A common cause is uploading an image again instead of selecting its existing attachment. Different editors may upload the same logo, or an export may be renamed before returning to WordPress. A content migration or scheduled importer can also create new attachments when it does not recognize an existing asset.
WordPress's unique-filename function resolves naming collisions; it does not establish that file content is unique. A suffix such as -1 can indicate a collision without proving that two pictures are identical. Conversely, different names can conceal exact copies.
Optimization and editing add another source of confusion. A JPEG and an intentionally generated WebP can represent the same picture for different delivery requirements. Cropping can produce an editorial variant. Preserve outputs that the site's processing and delivery configuration actually uses.
If the same picture appears twice on one page, inspect the page before cleaning storage. A theme can display a featured image as well as an image inserted into the content. Removing a library attachment does not fix that template configuration.
Find candidate pairs with native WordPress tools
Core WordPress provides browsing, text search, and filters, not an image-content deduplication scanner. The Media Library controls can help you assemble a small candidate group.
Open Media > Library and search for a distinctive subject, product name, or filename fragment. Clear date and file-type filters that could hide an older copy. Grid view helps you recognize the pictures; list view makes names and upload dates easier to compare.
Open each candidate's attachment details and record its ID, file URL, dimensions, file size, and useful title, caption, or rights information. The ID appears in the attachment's editing URL. Compare the full images, checking crops, text, transparency, language, and resolution rather than relying on their small previews.
Record whether the pair is an exact-copy candidate, an intentional variant, or unresolved. Leave unresolved files in place until you have checked their content and references.
Equal dimensions and equal file sizes are still insufficient proof. Different pictures can share both. A filename search also misses copies whose names and descriptions changed. For a large library, move from visual inspection to a documented content-comparison method.
Choose between exact hashes and visual similarity
A file hash summarizes bytes. A duplicate finder can use matching hashes to group exact-copy candidates without depending on their names. A changed embedded copyright field or recompressed JPEG changes those bytes, so an exact-file method can miss images that look the same.
Hashes also depend on which file is compared. A tool examining an attachment's uploaded source is doing a different job from one comparing generated thumbnails. Check the comparison input before interpreting a result. For sensitive consolidation, a final byte comparison can confirm a suspected exact match.
A perceptual hash summarizes visual characteristics instead. Related signatures can identify candidates after some image changes, but the result depends on the algorithm and its threshold. Crops, overlays, rotation, or substantially different compositions can defeat a particular method. The ImageHash project's documentation distinguishes image-oriented hashing methods and their behavior.
An exact match establishes something about file content, but it does not identify which attachment has the references or metadata to keep. A visual match gives you candidates to review; an alternate crop, product detail, or licensed export may still be necessary.
Semantic similarity has a broader meaning. Two photographs described as a brass desk lamp can depict related subjects without being copies of one another.
Use a duplicate-image plugin within its documented scope
Media Deduper identifies duplicates from file content and provides a Media > Manage Duplicates screen. Its listing describes an initial index, subsequent upload indexing, and an MD5 comparison of original attachment files. This is exact-file detection, not a visual-similarity search.
After backing up the database and uploads, install Media Deduper on staging. Open Media > Manage Duplicates and generate its index. Review one group, identify every member, and choose the attachment you would retain. Check the references to the other members before using a delete action.
The free plugin's Smart Delete protection covers featured images; its listing explicitly excludes galleries, post bodies, shortcodes, and custom fields from that protection. Do not interpret the action's name as complete reference repair. The vendor's documentation describes additional Pro integrations and the requirement that analyzed files be available locally. Remote-only media needs a supported analysis path.
For a visual-comparison example, Honeill Media Duplicate Manager documents SHA-256 exact matching and perceptual visual hashing, with manual selection of retained and deleted copies. Treat that as a documented feature set to evaluate on staging, not an independently tested recommendation or a promise that every reference is supported.
Check maintenance, the current tested-version declaration, and your actual WordPress/PHP versions before adopting either tool. Those declarations are not evidence of compatibility with every page builder or custom integration. No plugin performance tests are reported here.
Replace references before removing a duplicate attachment
Use a two-part backup: the database contains attachment identities and references, while uploads contain the files. If storage is offloaded, include its objects and the offload mapping. Confirm a restoration on staging before a large cleanup.
Consider a hypothetical pair: attachment 412 and attachment 739 contain identical product photos. You choose 412 because it has the needed source and useful metadata. That does not make deleting 739 safe: an article could store its URL, a product could store its ID, and a builder could store either inside structured data.
- Create a consolidation record. List the retained ID and URL, the candidate ID and URL, the comparison evidence, known uses, and the planned reference changes. Preserve useful metadata from both records.
- Inspect the reference locations your site uses. Include post content, featured images, galleries, synced patterns, templates, builder settings, custom fields, theme options, widgets, and product media. The Uploaded to column is not a complete usage inventory.
- Replace through the owning editor or a supported migration tool. For a normal Image block, select the retained image from the Media Library and check the crop, link, caption, and alt text. Update featured-image selections separately. Review WooCommerce product images, galleries, and variation images through their product controls.
- Handle custom data deliberately. A developer should check serialized values, custom tables, hardcoded paths, and generated CSS. A global text replacement of one numeric attachment ID can alter unrelated data. Changing URLs alone does not update ID-based references.
- Validate the changed pages before deletion. Check desktop and mobile rendering, product galleries, linked full-size files, and downloads. Confirm that relevant requests now use the retained asset or its valid derivatives.
- Remove only the reviewed copy. Use the WordPress or plugin workflow that understands its records and files. Do not delete the physical file through SFTP, especially if several attachment records share its path.
- Recheck and record the result. Inspect affected pages while logged out, account for caches, and watch for requests to the retired URL. Pause the next batch if anything is missing.
WooCommerce's product-media documentation explains its product image and gallery controls. Custom shops and variation interfaces can add other references, so validate the actual store rather than assuming the primary product image is the only dependency.
WordPress attachment deletion can remove associated metadata and files. A duplicate detector's finding does not make that operation reversible. Use a documented temporary trash mechanism only if the installed workflow actually supplies one; core media Trash behavior depends on configuration.
Preserve URLs and make rollback practical
Internal reference replacement cannot discover every external use. Another website, an email campaign, or a cached document may still request the old URL. If the URL must continue working, retain the asset or implement a deliberate URL-preservation or redirect plan and test the relevant image-size URLs too.
If consolidation breaks a page, stop. Restore the removed attachment and files from the supported recovery workflow, then restore the affected reference changes. A database restore can overwrite newer editorial work, so coordinate the recovery boundary. Restoring an image as a fresh upload generally gives it a new identity and is not equivalent to restoring the original attachment.
Separate the retention decision from storage savings. A generated size may still be necessary; an old reference may need to remain available. Removing a duplicate that visitors never downloaded does not, by itself, improve their page-load performance.
Prevent repeated uploads at the source
Before uploading, search the existing library and reuse the attachment. Keep recognizable product names and source identifiers in searchable fields. A consistent structure helps editors find the original before they create another copy; the WordPress Media Library organization workflow covers that setup.
For migrations and recurring imports, establish a stable source identifier and verify how the importer recognizes an existing asset. Test a repeat import on staging. A filename alone can be an unreliable identity when several sources use names such as image.jpg.
Choose one authoritative source for reusable media. Keep intentional crops and language variants recognizable, and distinguish them from accidental copies. A duplicate-upload warning can help if the chosen tool supports it, but it does not clean up every earlier import or establish which existing attachment should survive.
Where a central DAM helps with duplicate review
A central library can reduce the pattern of each project collecting another unmanaged copy. Vyso implements exact-duplicate grouping from stored checksums and file sizes, alongside near-duplicate candidates for manual review. A similar candidate is not a decision that the image is unnecessary.
Those checks apply to assets in Vyso's library. They do not inspect every WordPress attachment, repair its ID references, or determine which external pages use a file. The Vyso WordPress integration page still identifies the plugin as in development and unavailable to install. Keep WordPress reference consolidation in the WordPress workflow until an actual integration contract supports it.
Questions that affect the removal decision
Can I delete every file with a dimension suffix?
No. A name such as lamp-300x300.jpg can be a generated image size used by a template or responsive markup. Audit the registered sizes and their use separately from duplicate attachments.
Do identical images need identical alt text?
No. Alt text describes an image's purpose in its page context. Reusing the same attachment does not require duplicating the file to write context-appropriate alt text in a page. Check the resulting block markup after replacement.
Should I keep the oldest duplicate?
Age is one clue, not a retention rule. Prefer the source that meets the required quality, metadata, and URL obligations, and account for the references you would have to migrate. Sometimes retaining both is safer than an unjustified merge.
Keep going
Make the media library less work.
See how Vyso brings search, enrichment, cleanup, and delivery into one product.
Start free