
Minecraft runs on Java, and Java needs RAM allocated upfront. If you see "Out of Memory" errors, lag spikes, or crashes, you likely need to allocate more RAM. Here is how, first for the game on your own PC and then for a server.
For the Minecraft Client
Official Launcher
- Open the Minecraft Launcher
- Go to Installations
- Click the three dots on your profile, then Edit
- Click More Options
- Find the JVM Arguments field
- Change the number after
-Xmxto the amount you want, for example-Xmx2Gto-Xmx4Gfor 4 GB - Save
Prism Launcher
- Open Settings
- Go to Java
- Set the maximum memory under Memory
- Click OK
CurseForge App
- Click the settings gear in the lower left corner
- Open the Minecraft tab
- Under Java Settings, move the memory slider to the amount you want. CurseForge saves the change by itself
For a single modpack only, open My Modpacks, click the three dots on the profile, choose Profile Options and turn on Custom RAM Allocation.
For Minecraft Servers
A server works the same way, with two Java flags:
| Flag | Meaning |
|---|---|
| -Xms | Minimum RAM (starting allocation) |
| -Xmx | Maximum RAM (upper limit). This is the number you raise to add RAM |
If you only set -Xmx2G, the server can never use more than 2 GB, however much memory the machine has.
Edit the Start Script
Your server start script contains the RAM allocation:
java -Xms4G -Xmx4G -jar server.jar nogui
Change the numbers to allocate more:
java -Xms6G -Xmx6G -jar server.jar nogui
Save the file and restart the server.
Forge and NeoForge servers usually start with run.sh or run.bat, which read the memory flags from user_jvm_args.txt. Edit the -Xmx line in that file instead, because it decides how much the server gets.
Leave room for Java itself and the operating system. PaperMC advises setting -Xmx and -Xms about 1000 to 1500 MB below the memory you have: "Do you have 8GB of memory? Use 6500MB for safety."
With a Hosting Provider
On a hosted server the plan sets how much memory the server may use, so adding RAM means moving to a bigger plan. On a Space-Node Minecraft server you upgrade from the client area and keep your world, and you can see and change the startup flags yourself in the Startup tab of the panel.
How Much RAM Do You Need
Client
| Setup | Recommended RAM |
|---|---|
| Vanilla | 2 to 3 GB |
| Light mods (10 to 30 mods) | 3 to 4 GB |
| Heavy mods (50+ mods) | 4 to 6 GB |
| Heavy mods + shaders | 6 to 8 GB |
Server
| Setup | Players | Recommended RAM |
|---|---|---|
| Vanilla | 1 to 10 | 2 to 4 GB |
| Paper + plugins | 10 to 30 | 4 to 6 GB |
| Light modpack | 5 to 15 | 6 to 8 GB |
| Heavy modpack such as ATM10 | 1 to 15 | 12 to 16 GB |
| Heavy modpack | 15+ | 16 GB or more |
ATM10's own server files set an 8 GB Java heap, and Java needs memory on top of that, which is why we start that pack at 12 GB. Our server RAM guide goes through the sizing in more detail.
More RAM does not make a server faster on its own. It prevents crashes when the server needs the memory, and past that point it does nothing for TPS.
Common Mistakes
Allocating Too Much RAM
More is not always better. Prism Launcher's documentation puts it bluntly: more RAM allocated does not mean better performance, and outside big modpacks 4 GB should be more than enough. PaperMC says the same for servers: above a certain point you hit diminishing returns. On your own PC, every gigabyte you hand to Minecraft is one that Windows, your browser and Discord no longer have.
Not Setting Xms Equal to Xmx (Servers)
For servers, set -Xms and -Xmx to the same value. PaperMC's guide to Aikar's flags recommends it: with G1, the collector those flags use, unused memory is wasted memory.
Running an Old 32-bit Java
A 32-bit Java can only use a small heap, whatever you type after -Xmx. Current Minecraft rules it out anyway: Mojang's 1.20.5 changelog says the game "now requires a 64-bit Operating System", and Java 25, which 26.1 and newer need, no longer has a 32-bit x86 port at all (JEP 503). The launcher brings its own 64-bit Java; on a server, check that java -version mentions a 64-Bit VM.
Fixing Out-of-Memory Crashes on a Server
If the server still runs out of memory after you added RAM:
- Check that the new limit applied:
/spark healthshows the memory the server can use. - Lower view distance and simulation distance. Our simulation distance guide has starting values.
- Pregenerate the world, so the server is not generating terrain under load.
- Look for a plugin or mod that leaks memory:
/spark heapsummaryshows which kinds of objects fill the heap.
Checking Current RAM Usage
In-Game
Press F3 to open the debug screen. The top right shows memory usage, the used and the allocated amount.
Server
Run /spark health. Spark is built into Paper 1.21 and newer, and our spark guide covers the other server types. /tps on Paper only shows the tick rate, not memory.
Get the RAM your server needs. View Minecraft Hosting Plans