How Much Memory Does WordPress Need

How Much Memory Does WordPress Need

If you hit an “Allowed memory size exhausted” error, you need to raise the WordPress memory limit. A plain blog runs fine on the defaults, but WooCommerce, page builders, and busy plugins push real needs to 256M or higher. Here is how to size it without guessing.

The two memory limits in wp-config.php

WordPress controls memory with two constants you set in wp-config.php, above the “stop editing” line:

  • WP_MEMORY_LIMIT: the per-process limit for the front end. The default is 40M, which is enough for a light site but tight once plugins stack up.
  • WP_MAX_MEMORY_LIMIT: the limit for admin and background tasks like imports, updates, and image processing. The default is 256M.
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );

Note that PHP’s own memory_limit in php.ini sets a ceiling. WordPress cannot raise its limit above what PHP allows, so check both.

How much WordPress memory you actually need

A rough guide by site type:

  • Simple blog or brochure site: 64M to 128M is comfortable.
  • WooCommerce store: 256M minimum, since each request loads cart, sessions, and order logic.
  • Page builders (Divi, Elementor) plus many plugins: 256M to 512M, especially in the admin where the builder loads everything at once.

Do not just crank it to 1G. Oversizing per-process memory can starve your server of RAM under traffic, which leads us to the part most guides skip.

To size it for your exact plugin stack, the WordPress Memory Estimator adds up typical usage so you set a real number instead of guessing.

Per-process memory vs total server RAM

This is the distinction that trips people up. The limits above are per-process: they cap a single PHP worker. Your total server RAM needs to cover every worker running at once.

The math is simple:

total RAM for PHP = per-process memory x number of PHP-FPM workers

If you set WP_MEMORY_LIMIT to 256M and your server runs 8 PHP-FPM workers, peak PHP usage can reach roughly 2GB, before the database and web server take their share. Raise the per-process limit and you must either add RAM or reduce worker count. Get that balance wrong and the server swaps or kills processes under load.

Estimate and apply your limit

  1. Open the WordPress Memory Estimator and pick your site type and plugin load.
  2. Read the suggested per-process limit it returns.
  3. Add define( 'WP_MEMORY_LIMIT', '...' ); and define( 'WP_MAX_MEMORY_LIMIT', '...' ); to wp-config.php with that value.
  4. Multiply the per-process number by your PHP-FPM worker count to confirm your server has the RAM.
  5. Reload the page that was failing and confirm the error is gone.

The estimator runs entirely in your browser, so nothing about your site is sent anywhere.

Fixing “Allowed memory size exhausted”

When you see “Fatal error: Allowed memory size of X bytes exhausted,” PHP ran out of room mid-request. The fix is almost always to raise WP_MEMORY_LIMIT (or php.ini memory_limit) and retry. If the error returns immediately at a low number, a plugin or theme is leaking memory, so deactivate suspects one at a time to find the culprit.

Match the limit to your stack, check it against your worker count, and the memory errors stop.

← All posts