How to increase WordPress memory from 40MB to any number your server can handle

If you have a fairly complex WordPress website or WooCommerce store, you may come up with the situation that no matter what you do, both admin panel and frontend of the site loads very slowly. Especially if your site runs multilingual plugins.

The first thing you'd probably do is upgrade server to a faster one. Update PHP version and allow it to use more memory in php.ini . Remove every single plugin you don't actually need. Of course that will help but there's still a catch - WordPress uses up to 40 MB or memory by default. Even you set 256 MB of memory in PHP.

Here you'll learn how to quickly increase WordPress memory limit to make your website faster.

How to know how much memory your WordPress website can use, and how much is available in your server

Latest WordPress versions let you get lots of information about server specifications and WordPress limits without leaving WordPress panel. Go to Dashboard, Home, and click on Site Health screen link. If you can't find the Site Health Status at the home page you should enable it at the top - click Screen Options and check the checkbox to enable the widget.

wordpress site health screenOnce Site Health screen shows up click Info, and check how much memory your server allows to use. Open Server tab.

wordpress php memory limitHere you'll see that PHP let's you use up to 128MB of system memory. It may vary depending on the server configuration of course.

wordpress php memory limitNow click on WordPress Constants tab, and check how much memory WordPress allows to use:

how much memory WordPress can useAs you see it only allows using up to 40MB of memory so you can easily increase it.

How to increase WordPress memory limit

Allowing WordPress to use more memory is simple and straighforward - you need to add one line to wp-config.php file. And you can access this file multiple ways:

  • If you're using Cpanel or DirectAdmin, go to File Manager, open public or public_html folder, and open wp-config.php file for Edit.

  • If you want to edit wp-config.php file using Filezilla or any other FTP Client, you'll find the file in public or public_html folder.

Once you open wp-config.php, add this line near the top of the file (for example just over database credentials):

define('WP_MEMORY_LIMIT', '128M');

If your server allows uses 128MB memory, and you have no other software in your server except WordPress website, you can increase WordPress memory up to 128MB (128M in the config file). If you have more software in the same server, and it uses the same PHP version as your WordPress website, you should leave some memory for the other software too, so enter smaller number.

Letting WordPress use 128MB is more than enough in most cases, even if you have a server which has way more memory. Your site will probably won't use all that 128MB anyway, but it will have more room to expand if it gets busy.

Here's how the file should look like:

wordpress increase memory limit from 40MB to moreOnce you save changes in wp-config.php file the changes should be applied immediately. Now you can go to Site Health Screen again, and check if you've done everything correctly.

wordpress how to increase memoryAs you see, WordPress memory limit is successfully increased.