Performance & Security

How to Increase WordPress Memory Limit (2026)

WordPress runs on PHP, and PHP gives every website a fixed amount of memory to work with. When your site needs more memory than that limit allows, you get the dreaded fatal error that says allowed memory size exhausted, uploads fail, the editor freezes, and sometimes the whole site shows a white screen. Raising the WordPress memory limit is one of the simplest performance fixes you can do yourself, and you do not need a plugin for it.

This guide shows how to increase the WordPress memory limit without a plugin, using wp-config.php, php.ini, .htaccess, or your hosting panel. You will also learn how to check your current limit, which values are safe, and the important part most guides skip: when more memory is the wrong fix and your real problem is a bad plugin or a broken process eating memory for no good reason.

What Is the WordPress Memory Limit?

The WordPress memory limit is the maximum amount of RAM that PHP is allowed to use while running your site. Every page load, image upload, plugin update, and admin action consumes some of that memory, and when the total crosses the limit, PHP stops the process and WordPress shows an error. The default limit on many hosts is 40M for a single site and 64M for a multisite network, which was fine years ago but is often too low for a modern site with a page builder, a security plugin, and a backup plugin all running at once.

WordPress defines its own limit with a constant called WP_MEMORY_LIMIT, which tells PHP how much memory the front end and admin may use. There is a second constant, WP_MAX_MEMORY_LIMIT, which sets the limit for admin tasks such as media uploads and plugin updates. WordPress will use the higher of the two in the admin area, which is why raising both values is the standard recommendation. If your host caps PHP memory below the value you set, WordPress cannot override that cap, so the host setting always wins in the end.

How to Check Your Current WordPress Memory Limit

Before you change anything, check what your site is using right now. Go to your WordPress dashboard, open Tools, then Site Health, then click the Info tab and expand the Server section. You will see a line that shows the PHP memory limit, along with the PHP version and the server software. That number is the limit your site is actually running with, and it is the baseline you will compare against after your change.

Site Health also has a Status tab that flags a low memory limit as a recommended improvement, so if your limit is below 128M you will probably see a warning there. Make a note of the current value before you edit anything, because you will want to confirm that it actually changed after you save. If you cannot find the Site Health screen, your host may have disabled it, in which case a tiny PHP info file or a quick question to host support will tell you the same number.

Method 1: How to Increase the Memory Limit in wp-config.php

Editing wp-config.php is the most common method, and it works on almost every host. This file sits in the root folder of your WordPress installation, next to wp-admin and wp-content. Download a backup copy first, then open the file and add the two lines below just above the line that says “That is all, stop editing!” WordPress reads these constants early, so their position matters, and placing them anywhere else in the file may mean they never take effect.

define( ‘WP_MEMORY_LIMIT’, ‘256M’ );
define( ‘WP_MAX_MEMORY_LIMIT’, ‘512M’ );

A limit of 256M for the front end and 512M for admin tasks is a safe starting point for most sites. Small blogs can run happily on 128M, while heavy WooCommerce stores and sites with page builders often need 256M or more. Do not jump straight to 1024M, because a huge limit hides the real problem if a plugin has a memory leak, and it lets a runaway process consume far more server memory than it should. Save the file, upload it back, then check Site Health again to confirm the new value is active.

Method 2: How to Increase the Memory Limit in php.ini

If the wp-config.php method does not change the number in Site Health, your host may be enforcing the limit at the PHP level. In that case, edit the php.ini file instead. On shared hosting you can often find a PHP settings section in cPanel under Select PHP Version or MultiPHP INI Editor. Open the editor for your domain, find the memory_limit setting, change it to 256M, and save. The change usually takes effect immediately, but some hosts need a few minutes or a PHP restart.

If you have VPS or dedicated hosting with full server access, you can edit php.ini directly. Find the memory_limit line, change its value to 256M, save the file, and restart PHP or your web server. If you cannot find php.ini at all, create a file named php.ini in your WordPress root folder with the line below inside it. Some hosts read a local php.ini, while others ignore it, so confirm the result in Site Health either way.

memory_limit = 256M

Method 3: How to Increase the Memory Limit in .htaccess

On Apache servers, you can set the PHP memory limit from .htaccess, the configuration file in your WordPress root folder. Add the line below to the file, save it, and check Site Health to see if the new limit took effect. This method only works if your host allows PHP settings in .htaccess, and it does nothing on Nginx servers, which do not read .htaccess at all.

php_value memory_limit 256M

If adding this line breaks your site with a 500 error, your host does not allow php_value directives, and you should remove the line immediately and use the wp-config.php or php.ini method instead. A 500 error after an .htaccess edit is almost always caused by a directive the server rejects, so revert the change first and diagnose second. Our guide on how to fix the WordPress 500 internal server error covers this kind of failure in detail if you need a deeper walkthrough.

Method 4: How to Increase the Memory Limit From Your Hosting Panel

Many modern hosts, including managed WordPress hosts and panels such as Cloudways, SiteGround, and Kinsta, let you change the PHP memory limit from a settings page with no file editing at all. Look for a PHP Settings, PHP Configuration, or Application Settings area in your hosting dashboard. Change memory_limit to 256M, save, and confirm the new value in Site Health. This is the safest method if you are uncomfortable editing files, because the panel validates the value and there is no risk of a typo breaking the site.

If none of the methods above change the number, your hosting plan itself may cap memory below what you need. Budget shared plans sometimes lock memory at 128M or lower with no way to raise it. At that point, the honest fix is to contact support and ask for a higher cap, or to move to a plan with more resources. A good host matters more than any single setting, so if you are shopping around, our web hosting guide explains what to look for in a host that gives WordPress the resources it needs.

When More Memory Is the Wrong Fix

Raising the memory limit fixes genuine shortages, but it can also hide a real problem. If your site needs 512M just to load the admin dashboard, something is wrong, and more memory only delays the crash. A single badly coded plugin can eat memory on every page load, and doubling the limit just lets it eat twice as much. Before you raise the limit past 256M, check whether the problem has another cause.

  • A memory error that started after installing or updating one plugin points to that plugin, so deactivate it and test again.
  • A slow admin dashboard with a normal front end often means a plugin is doing heavy work in the admin area, not a memory shortage.
  • Timeouts during imports or backups are often caused by the PHP max execution time, not memory, and need a different setting.
  • A database full of expired transients, spam comments, and post revisions can slow everything down while using extra memory.

Work through these causes one by one. Our guide on how to fix a slow WordPress admin dashboard shows how to find the plugin responsible, and our guide on how to optimize the WordPress database without a plugin covers cleaning the tables that bloat over time. If the memory error disappears after deactivating a plugin, report the problem to that plugin author or find a lighter replacement instead of raising the limit to cover for it.

What Memory Limit Should You Set?

There is no single correct value, because it depends on what your site runs. A simple blog with a light theme and a handful of plugins is fine on 128M. A site with a page builder, a form plugin, a security plugin, and an SEO plugin should use 256M. A WooCommerce store with many products and extensions may need 256M to 512M. Start at 256M, watch Site Health for a week, and only raise it further if you still see memory errors after cleaning up plugins and the database.

Remember that the memory limit is a ceiling, not an allocation. Setting it to 512M does not mean WordPress uses 512M on every page load. It only means PHP is allowed to go that high if a task genuinely needs it. That is why a generous limit is harmless on a healthy site and dangerous only when it masks a leak. Pair a sensible limit with regular plugin audits, and your site will stay fast without needing constant increases.

Frequently Asked Questions

What is a good WordPress memory limit?

A limit of 256M works well for most WordPress sites, with 512M set as the admin maximum for heavy tasks. Small blogs can run on 128M, while large WooCommerce stores may need 256M to 512M. Start at 256M, confirm it in Site Health, and raise it only if you still see memory errors after removing problem plugins.

Why does WordPress say allowed memory size exhausted?

This error means a page or task needed more memory than the PHP limit allows. Common causes are a plugin with a memory leak, a very large image being processed, or a limit that is simply too low for the plugins you run. Raise the limit to 256M, then deactivate recently added plugins one by one to find the real cause if the error returns.

Can I increase the WordPress memory limit without a plugin?

Yes, you can raise it without any plugin by adding WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT to wp-config.php, by changing memory_limit in php.ini, by adding a php_value line to .htaccess on Apache, or from your hosting panel. The wp-config.php method works on most hosts and takes under five minutes. The official WordPress memory limit documentation explains these constants and their default values.

Will increasing the memory limit make my site faster?

It can fix slowness that is caused by memory exhaustion, such as failed uploads or admin pages that time out, but it will not speed up a site that is slow for other reasons. Caching, image optimization, a fast host, and removing heavy plugins have a much bigger effect on speed. Treat the memory limit as a safety net, not a performance upgrade.

Last updated: November 2026.

Hostinger - Get 20% OFF

Habib ur Rehman

Hello! I'm the founder of VU Tech Geek. As a BSCS graduate and experienced WordPress professional, I'm passionate about technology and education. My Virtual University journey has given me valuable insights and knowledge, which I love to share with fellow students.… More »

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker