How much RAM a Minecraft server really needs for vanilla, Paper, plugin and modded servers, how to set -Xmx, and why more memory can cause lag.
The short answer
There is no single number, because memory use depends on how many players are online, how far they can see, how many plugins or mods you run and how big the world has grown. As a rough starting point for a Java Edition server on Paper:
- 2 GB: a few friends, vanilla-style survival, a handful of light plugins.
- 4 GB: a small public server of about 10 to 20 players with a normal plugin set.
- 6 to 8 GB: 20 to 50 players, bigger worlds, heavier plugins such as land claims, economy and custom items.
- 10 GB and up: large networks, big modpacks, or many players spread over a huge map.
These are starting points to measure against, not promises. Use the checks in the last section to see what your own server actually needs.
What actually uses the memory
- Loaded chunks: every chunk around every player stays in memory. A higher view distance or simulation distance means many more chunks per player.
- Entities and redstone: farms, mob grinders, item frames and hoppers all add up, even when nobody is near them.
- Plugins: most are small, but map renderers, economy and land plugins, and anything that caches player data can be large.
- Modpacks: a Forge or Fabric pack with hundreds of mods commonly needs 6 to 10 GB before a single player joins.
- The operating system: leave 1 to 2 GB free for the system itself, or the machine starts swapping and everything stalls.
Set the amount with Java flags
Memory is set when you start the server with -Xms (starting size) and -Xmx (maximum size). Set both to the same number so the server does not spend time resizing the heap while players are on.
Start script for a 4 GB Paper server
java -Xms4G -Xmx4G -jar paper.jar --noguiNever give the server all of the machine's RAM. On a 8 GB machine, 5 to 6 GB for Minecraft is plenty.
More memory is not always better
Java cleans up unused memory in the background (garbage collection). With a huge heap and default settings, each cleanup can pause the server for a noticeable moment, which players feel as lag spikes. A server that needs 4 GB often runs smoother with 4 GB than with 16 GB.
If you have 5 GB or more, community-tested start flags such as Aikar's flags tune the garbage collector for Minecraft. Search for Aikar's flags and use the version for your heap size. Many hosts add them for you.
How to tell if you have the right amount
- Play for a normal busy period, then run a profiler such as spark with /spark healthreport. It shows memory use, tick speed and what is slow.
- Look at how much memory is free after garbage collection. If the heap is regularly more than 85 to 90 percent full after cleanups, add memory.
- Check the TPS (ticks per second) with /tps. A healthy server stays at 20. If TPS drops while memory is nearly full, you are short on RAM. If TPS drops while memory is fine, the problem is something else, usually CPU or a heavy farm or plugin.
- Add memory in small steps, such as 1 GB at a time, and measure again.
Choosing a host
When you compare hosting plans, RAM is only one number. Single-core CPU speed matters more than most people expect, because the main game loop runs on one thread. A plan with fast cores and 4 GB usually beats a slow-core plan with 8 GB. Also check that the plan lets you choose the Java version and server software, and that it includes backups.
Frequently asked questions
How much RAM do I need for a Minecraft server?
As a rough start: 2 GB for a few friends, 4 GB for 10 to 20 players on Paper, 6 to 8 GB for 20 to 50 players or heavier plugins, and 10 GB or more for big modpacks. Measure with a profiler such as spark, because world size, view distance and plugins change the number.
Is more RAM always better for a Minecraft server?
No. A very large heap can make Java's garbage collection pauses longer, which players feel as lag spikes. Give the server what it needs, set -Xms and -Xmx to the same value, and leave 1 to 2 GB for the operating system.
How do I set the RAM for my Minecraft server?
Start the server with Java flags, for example java -Xms4G -Xmx4G -jar paper.jar --nogui. -Xms is the starting memory and -Xmx is the maximum.
How many players can 4 GB of RAM handle?
A 4 GB Paper server often runs about 10 to 20 players with a normal plugin set. Fast CPU cores and a modest view distance matter as much as the RAM.