The size of your WordPress Media Library will increase over time, taking up disk space and slowing down your website. That's why it is recommended to clean up your WordPress Media Library regularly.
In this guide, we show you how to clean up unused media files manually or with a plugin, and give you tips on how to avoid a large Media Library.
- What is the WordPress Media Library?
- Why clean up the WordPress Media Library?
- How to delete unused files manually
- Use a plugin to clean up the Media Library
- How to avoid a large Media Library
Don't have a website yet? With WordPress, you can easily and quickly build the website of your dreams.
What is the WordPress Media Library?
The WordPress Media Library is a catalogue of all the media files that you have uploaded to your website, such as images, audio and video files and documents. You can find the Media Library in your WordPress dashboard.
- Log into your WordPress admin dashboard.
- Click Media in the menu on the left and select Library.
Why clean up the WordPress Media Library?
The size of your WordPress Media Library will increase over time because unused images are not automatically deleted. WordPress also duplicates uploaded images into different sizes by default.
A large Media Library takes up unnecessary disk space, increases backup sizes, complicates media management and negatively affects the performance and speed of your website. If your website has been up and running for some time, chances are high that the Media Library contains images that are not actually used by your website.
How to delete unused files manually
If your Media Library isn't very large and has a manageable file count, you can remove unused files manually. You can either remove a single image at a time or bulk-remove multiple images in one go.
Note: This action cannot be undone. Before you continue we recommend that you make a backup of your site. Check out our guides below if you're unsure how to do this.
- In the WordPress dashboard, click on Media in the menu on the left and select Library.
- Select the image you want to delete.
- In the pop-up window showing the attachment details, choose Delete Permanently in the bottom-right corner.
- Click OK to confirm that you want to permanently delete the file.
Tip: You can also bulk-delete files and images. Simply click the button Bulk Select in the Media Library, choose all files you would like to delete, and click on "Delete Selected".
Use a plugin to clean up the Media Library
If you have a large Media Library, it can be time-consuming to clean it up manually. Luckily, there are plugins that can help you.
We recommend using the plugin Media Cleaner to clean up your Media Library. Media Cleaner is a free plugin, that will scan your WordPress Media Library and look for files that are broken or aren't actually used by your website.
Note: Any media files removed by the plugin will be permanently deleted. Before you continue we recommend that you make a backup of your site. Check out our guides below if you're unsure how to do this.
- Go to the Plugins page in your WordPress admin dashboard.
- Search for media cleaner, and install and activate the plugin called "Media Cleaner - Clean & Optimize Space".
- Select Cleaner under Meow Apps in the menu on the left.
- Click "Access Media Cleaner Dashboard", scroll down and click Scan.
- Select the files that you want to remove and click Delete.
Tip: You can also click on the Delete All button to remove all unwanted media files in one go.
How to avoid a large media library
There are some preventive actions you can take to keep the media library from growing too big. We have collected some tips for you.
Optimise your images
The primary goal of optimising your images is to find the balance between the lowest file size and an acceptable quality. There are many benefits of optimising your images, such as making your website load faster, improved SEO rankings, using less disk space and faster website backups.
Compress images before uploading
Image compression is an important factor when it comes to optimising images.
You can compress your images before you upload them to the media library in an image editing tool such as Adobe Photoshop or GIMP. There are also tools online that you can make use of.
Don't want to manually compress your images before uploading them? Use the free plugin Imagify to optimise all images. It's included in all 1-click WordPress installations by default.
Upload smaller images
Another important factor when it comes to image optimisation is image scaling.
Images directly uploaded from smartphones or cameras are usually high-quality images that are huge in file size and not optimised for the web. Usually, these huge images are not shown in their original size on the website but are instead downsized with HTML or CSS, yet the visitor's browser still downloads the full-size image in its original size.
Instead, we recommend that you upload smaller images to the media library so that it matches the actual pixel dimensions you use to display it on your website, which means a reduction in file size.
Regular checkups
It is recommended to regularly check and clean up your WordPress media library to keep it from accumulating in size. We recommend you do this on a monthly basis, but the more often you do it the better.
Use JPG format rather than PNG
Two of the most common file image formats are JPG and PNG. JPG files are better for photography while PNG is preferred when it comes to graphs, images with text or that require the use of a transparent background, such as logos for instance.
PNG files are often higher in quality but that also makes them bigger in file size. We recommend using JPG files for images on your website because images that are big in size will make your website load slower and impact the visitor experience negatively.
Related articles: