Magento 2 image cleanup is essential for performance optimization. Because deleting a product or page in the platform does not remove its associated images from the server. And it can clog up the hosting server’s disk space over time.
Removing these unused images in Magento 2 helps free the disk space and enhance the performance.
In this post, you’ll learn how to remove unused product images in Magento 2 and how to schedule automatic cleanups.
Why Clean Unused Images in Magento 2?
Here are a few reasons you should regularly clean unused images in Magento 2:
- Optimize the hosting storage space
- Improve the server performance
- Enhance Magento site management
- Reduce Magento 2 store backup size
Cleaning unused images in Magento 2 is a good practice overall. It can help you with many benefits, like optimizing your Magento 2 server storage and performance.
Method to Remove Unused Images in Magento 2
The image clean extension for Magento 2 by Meetanshi helps you identify and remove unused images. It is approved by Adobe Marketplace and also supports auto-cleaning on a schedule.
Step 1: Install Magento 2 Image Clean Extension
Go to Magento 2 Image Clean by Meetanshi and download the extension for your store.

Extract the downloaded zip file and upload it to your Magento 2 root directory via FTP.
Log into your Magento 2 SSH and run the following commands one by one to install the extension:
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy –f
php bin/magento cache:flush
The Magento 2 Image Clean extension will be successfully added to your store.
Step 2: Perform a Bulk Image Clean
The Image Clean extension by Meetanshi helps you identify and remove unused images in your store. The Configuration > Unused Product Images and Configuration > Unused Category Images grids provide a list of unused images in products and categories that you can manually clean.
You can also bulk-clean the unused product images in Magento 2 from the extension configuration.
Log into your Magento 2 admin panel and navigate to Image Clean > Configuration in the left menu.

In the Image Clean Configuration, choose the resources you want to clean. You can select from:
- Unused Category Images
- Unused Product Images
- Database Record for Non-existing Product Images
Set the maximum number of images you want to process in each clean (e.g., 10,000) and click “Clean Now.”

It will clean the selected Magento 2 resources and remove unused images from products, categories, and databases. You can verify the results by checking the number of unused images in Magento 2 from the Image Clean > Unused Product Images and Image Clean > Unused Category Images grids.
Step 3: Schedule Automatic Image Clean in Magento 2
The extension allows you to automatically remove unused product images in Magento 2 on a schedule. It helps you keep your store clean and storage optimized.
Set Schedule Periodic Clean Up to “Yes” and select the cleanup frequency from:
- Daily
- Weekly
- Monthly
Set the start time for the Magento 2 image clean process.

Click the “Save” button on the top right.
Now, the extension will run scheduled image cleanups in Magento 2 as configured on a cron job. This is helpful for keeping your Magento 2 storage clean and optimizing it for performance. The best part is that it requires only a onetime setup and helps you save time.
Remove unused product and category images from media folder and dashboard.
Get ExtensionFor Developers: Commands to Find & Remove Unused Images in Magento 2
The Magento 2 Image Clean extension also lets you perform operations programmatically. Developers can use the following SSH commands to clean Magento 2 images:
Image Clean Task | SSH Command |
---|---|
Find all the unused product images in Magento 2 | php bin/magento imageclean:product-unused-image:fetch |
Find all the unused category images in Magento 2 | php bin/magento imageclean:category-image:fetch |
Remove all the unused product images in Magento 2 | php bin/magento imageclean:product-image:clean |
Remove all the unused category images in Magento 2 | php bin/magento imageclean:category-image:clean |
The Magento 2 Image Clean extension by Meetanshi is the simplest way to find and remove unused images in your store. The extension supports image clean-up automatically on a schedule to prevent your hosting server from running out of storage.