There is no such thing as “unlimited” disk space or bandwidth when it comes to web hosting. Shared WordPress hosts typically advertise this but still have limits in place behind the scenes if you read their terms of service (TOS). Over time your WordPress site can grow pretty fast, and eventually, you might hit your limits, whether it be 5 GB or 20 GB.
If you hit the magical “unlimited” quota, this is usually an email from your host saying you’re abusing their TOS. So today we will share with you a few ways to check disk usage in WordPress so you can clean up your sites. There are a lot of server commands that allow you to do this, but we are going to focus on some easy ways for those that may not be comfortable using SSH or aren’t as tech-savvy.
Your website grows bigger every day. Here are 7 easy ways to check disk usage in WordPress. Find those large files and DB tables! 🗑️ Click to Tweet
Calculating Disk Usage in WordPress
Before we dive into how to check your disk usage, it is important to understand that what we are referring to. In WordPress, disk usage is typically composed of two things; your files and database. Combined these make up your total disk usage that is being used on your server, that take up your allocated resources.
Tired of slow WordPress hosting & subpar support? We do things different at Kinsta.
Files on the Server
WordPress files that take up disk space include things such as:
- Images and video uploaded to your media library (typically in /wp-content/uploads/)
- Theme and plugin files (PHP, CSS, JS) (typically in /wp-content/themes/ and wp-content/plugins/)
- WordPress core (your main WordPress installation files) (typically in the root or public_html folder)
- Any files uploaded via FTP (such as custom web fonts, libraries, etc.)
MySQL Database File
Your WordPress MySQL database file stores all of the information on your WordPress site, such as post data, page data, meta information, plugin settings, users, login information, etc. If you’re a Kinsta client, you can quickly see your total disk usage on your MyKinsta dashboard.
WordPress total disk usage
7 Ways to Calculate Disk Usage
A lot of managed WordPress hosts like Kinsta don’t use cPanel and have their own built-in reporting to view resource usage for your site. And these might not always give you the data you need. Providers typically focus on an overview and less on the granular level. Although some do have some granular reporting via CSV. So this is where the following methods below can come in handy for getting more information about disk usage, for both your files and database.
- Check Disk and Database Usage with Site Health Tool
- Check Database Size with WordPress Plugin
- Check Database Size with phpMyAdmin
- Check Disk Usage and Database Size in cPanel
- Ask Your Hosting Provider
- Dive Into Disk Usage Locally
- Check Disk Usage via SSH
1. Check Disk and Database Usage with Site Health Tool
With the release of WordPress 5.2, came a new tool built into core called “Site Health.” It’s actually pretty awesome and includes a lot of useful data about your WordPress site and server. With it, you can check the size of your WordPress directories and database.
In your WordPress dashboard, browse to “Tools → Site Health → Info.” Under the “Directories and Sizes” tab you’ll find the following info about your site:
- WordPress directory size
- Uploads directory size
- Themes directory size
- Plugins directory size
- Database size
- Total installation size
WordPress Site Health tool directory and sizes
2. Check Database Size With WordPress Plugin
Perhaps you are wanting to see more granular data on your WordPress database size? For example, knowing just the total size isn’t very helpful if you are trying to determine what is taking up space in the database. That is where the Advanced Database Cleaner plugin can come in handy. Essentially it is a tool to analyze and clean up your database. There is both a free and premium version.
Advanced Database Cleaner plugin
As of writing this, it has over 50,000 active installs with an impressive 5 out of 5-star rating. You can download it from the WordPress repository or by searching for it within your WordPress dashboard under “Add New” plugins.
Once installed you can click on WP DB Cleaner in your WordPress dashboard and then click on the “Tables” tab. There are a lot of optimizations you can do with this plugin but we won’t be going into those today, we are concerned with spotting what is using up the most space in your database.
Typically database tables will be named something similar to the name of the plugin they are used by. Right off the bat, we were able to spot “database waste.” For example, the “ab_press_optimizer” tables are used by the AB Press Optimizer plugin which was no longer being used on the site we were analyzing. Also, the “icl_translations” table is used by the WPML plugin for multilingual installs. However, this site isn’t multilingual.
A lot of times plugins are installed and then removed but the database tables are left behind. You can usually safely remove these from your database (we will go into this more in the phpMyAdmin step below). Remember to always take a backup of your database first. If you aren’t comfortable doing this, we recommend chatting with a developer.
The one downfall to the Advanced Database Cleaner plugin is that you can’t sort the rows by data size.
Another big table we noticed was the “tve_leads” table. This is used by the popular Thrive Leads plugin. However, the site in question didn’t use this plugin. So again, if you check your WordPress site you will probably find a lot of leftover tables that should be cleaned up and or removed.
Thrive Leads table
Don’t know what table belongs to which plugin? In a lot of cases, a simple Google search will reveal the answer.
Google search WordPress table
You can also see the total database size in the Advanced Database Cleaner plugin under the “Overview & Settings” tab.
Total database size in plugin
3. Check Database Size with phpMyAdmin
You can also check your database size and analyze your tables with phpMyAdmin. Many hosts will have a shortcut to access this within your control panel or perhaps a link in your setup email. If you are Kinsta client you can access phpMyAdmin by clicking into your site’s Info tab, scrolling down to the Database section, and clicking on “Open phpMyadmin.”
WordPress phpMyAdmin access
Click on your database on the left-hand side. You can then sort your database’s tables by total size.
On the WordPress site we analyzed, over 70% of the large database tables (other than core) were created by plugins that were no longer being used on the site. Which means our database was using way more disk space than it needed to. The older your site is the more likely you are to have data left behind.
You can easily delete these unused tables by selecting them and choosing “Drop” from the drop-down. However, we always recommend that you backup your database before doing this. Check out our quick and easy tutorial on how to backup your MySQL database using phpMyAdmin. Or if you’re a Kinsta client, you can easily create a backup from the MyKinsta dashboard.
Drop tables in phpMyAdmin
4. Check Disk Usage and Database Size in cPanel
If your host uses cPanel, you can easily see an overview of your total disk usage and MySQL database on the sidebar.
cPanel disk usage overview
You can also dive into the disk usage reports for more granular data. Simply click on “Disk Usage” under Files.
cPanel disk usage
At the bottom of the screen, you can then drill down into the folders and sort them by disk usage.
cPanel drill down disk usage
An alternative way to view your MySQL database size would be to click on “MySQL Databases” under Databases.
cPanel MySQL databases
Then under current databases, it will show you the total size of the database.
cPanel MySQL database size
5. Ask Your Hosting Provider
Another way to check your current granular disk usage and database size is to ask your host to provide you with a report. A lot of times the hosting provider can quickly run server commands to generate a tree/granular report on directories to show you what is taking up the most space. It might not always be the prettiest report, but it will give you the data you need. A host should always be happy to assist you in finding ways to clean up unused data, as this is beneficial to both.
It’s also important to know if your host includes your staging sites or not in your total disk usage. Here at Kinsta, we try to give clients as much space as possible, and therefore staging sites are excluded from our reporting when calculating total disk space usage. Only live sites count against your disk space usage. The same goes for backups.
6. Dive into Disk Usage Locally
Another way to analyze your WordPress disk usage is to dive into the data locally on your computer. This can be done two different ways:
- Option 1: Download a full archive backup of your site from your hosting provider’s control panel. At Kinsta, we have easy one-click downloadable backups. This is the fastest method.
- Option 2: Connect via SFTP and downloading your entire site. Or in most cases, you will only need your /wp-content/ folder. Depending on the size of your site and internet connection, this could take a while.
It is important to remember that if your host charges you by bandwidth (Kinsta doesn’t), that this will use part of your monthly quota. So we don’t recommend doing this all the time, perhaps once every 6 months. Or if you have a smaller site, this probably won’t be an issue.
Even though this method takes more time, it can be one of the most powerful ways to analyze your disk usage, as you can dissect the data very quickly, and use a tool of your choice. You can use a directory size tool to analyze your site.
For Windows, we highly recommend the free TreeSize software, which we will be using in this example.
You can select your /wp-content/ folder that you downloaded and it will quickly scan it to show you the exact size of everything in it. As you can see below, this is much better than any plugin or export from your server. If you analyze the data locally, you can really take advantage of some powerful tools like this.
TreeSize wp-content folder
If we narrow down into the large folder in uploads we can instantly see that there were some very large images/photos that were uploaded that probably weren’t optimized. The one mind-blown.gif is over 3.5 MB alone, which is way too large for an optimized image. There are some easy ways to compress animated GIFs which should have been done here.
Large images taking up disk space
Make sure to check out our in-depth post on how to optimize images for web. TreeSize is awesome for quickly digging through your site and spotting issues within seconds.
For Mac, you might want to check out OmniDiskSweeper. It’s free, and you can easily scan your /wp-content/ folder and find the large files that are taking up the most space on your site.
Large files in wp-content folder
7. Check Disk Usage via SSH
The last and final way to analyze your disk usage is via SSH. While this is probably for the more tech-savvy, we thought we would still include it, as it is pretty easy to do. Simply log in to your host via SSH. Then use the following commands. The first will navigate you to your wp-content folder using the “change directory” (cd) command. Note: This location may vary on certain hosts.
You can then use the following command to sort the folder with the smallest files on the top and largest on the bottom.
du -sh * | sort -h
You can go as deep as you need (using the same commands) until you find what is taking up the most space on your site. In this case, it is our uploads folder.
Check disk usage SSH
As you can see below, our 04 (April) 2016 folder is taking up much more space than our other months and years.
Large folder SSH
After going into that directory we realized it was due to some very large GIFs and PNGs being used. We recommend trying to keep your images under 100 KB.
Large files SSH
Reducing Disk Usage in WordPress
Here are a few quick and simple recommendations for reducing disk usage on your WordPress site.
- Optimize your images. Try to keep your images under 100 KB.
- Use a plugin like Media Cleaner to get rid of unused media on your site.
- Delete old themes and plugins.
- Cleanup unused database tables left behind from plugins no longer being used. Check out our in-depth post on autoloaded data.
- Check your WordPress installation using some of the tips above to ensure large files are there for a reason.
- Disable or limit WordPress revisions to keep your database small.
- Remove old log files.
- Remove backup files and store them offsite. Remember, MyKinsta backups aren’t counted against your disk usage at Kinsta.
- Cleanup and delete comments in spam or trash
As you can see, there are quite a few different ways to check your disk usage and database size in WordPress, even for those who aren’t very tech-savvy. Remember that over time you probably have accumulated a lot of extra bloat on your site, consisting of both files and tables in your database. Doing a checkup once every 6 months can be a good way to ensure you keep your disk usage to a minimum, reduce storage costs, and help speed up your site.
Do you have any other easy tricks you use to check disk usage on your WordPress site? If so, feel free to share them below in the comments.