To allocate more RAM to a Minecraft server, change the -Xmx number (the maximum memory) in the script or file that launches it, then stop the server and start it again. On a hosted server you change it in the host's plan or panel instead, and on some hosts you can't change it at all. This page is about Java Edition servers only.
The part that trips people up isn't the number. It's finding the right file for your setup, and making sure you're actually launching the server through it. Pick your setup below.
| Your setup | Where the memory setting lives |
|---|---|
| Vanilla, Paper or other plain server jar | -Xmx in your start.bat or start.sh |
| Forge or NeoForge server | user_jvm_args.txt, started through run.bat or run.sh |
| ATLauncher server pack | set maxmemory= in LaunchServer.bat, or MEMORY= in LaunchServer.sh |
| CurseForge or other modpack server | Depends on the pack. Check its start script, run.bat or user_jvm_args.txt |
| Aternos | You can't set it. Aternos assigns it |
| Minehut | Your server plan |
| Paid host | The plan or a memory field in the host's panel |
Allocate more RAM in a start script (Windows, macOS, Linux)
Two flags control the heap. -Xmx is the maximum memory Java can use. -Xms is the memory it grabs at startup. Both go between java and -jar. Anything after -jar server.jar gets handed to the server, not to Java, so a flag put there does nothing.
On Windows, a start.bat next to your server jar looks like this:
@ECHO OFFjava -Xms1G -Xmx4G -jar server.jar --noguipause
The pause keeps the window open so you can read any error. Save it and double-click to start.
On macOS and Linux, use start.sh:
#!/bin/shcd "$(dirname "$0")"exec java -Xms1G -Xmx4G -jar server.jar --nogui
Run chmod a+x start.sh once, then start it with ./start.sh. Same story if you're running a server on a Mac.
Units: G or M, nothing else
Write -Xmx6G or -Xmx6144M. Not -Xmx6GB, which is an invalid heap size and the server won't start.
What to do about -Xms
It only affects startup. If the machine runs other stuff too, the Minecraft Wiki suggests a quarter of your max. If the box is dedicated to the server, setting it equal to -Xmx is fine, and Paper's docs recommend that too.
Check your Java version
The script only runs if Java is new enough. As of 2026, the Minecraft Wiki lists Java 25 for 26.1 and later, Java 21 for 1.20.5 and later, and Java 17 for 1.18 and later. Setting up from scratch? My guide to making a Minecraft server covers the Java install and the first run.
Forge and NeoForge: user_jvm_args.txt
Forge and NeoForge servers don't use a hand-written java line. After you run the installer, you get a user_jvm_args.txt file. Open it, and the comments inside explain the rest. The relevant lines look like this:
# A good default for a modded server is 4GB.# Uncomment the next line to set it.# -Xmx4G
That # makes the line a comment, so Java ignores it. Delete the # and change the number, for example -Xmx6G. If you want a minimum too, add -Xms on its own line. Then start the server with run.bat (Windows) or run.sh (Linux and macOS).
The "I edited it and nothing changed" trap
You'll see this complaint all over the Forge and CurseForge threads: someone edits user_jvm_args.txt and the server stays on 2GB. Run through this list:
- The line still starts with
#. - You're starting the server some other way, like a custom launcher command or a panel start command that never reads
user_jvm_args.txt. Start it fromrun.batorrun.shand see if it changes. - You didn't fully stop and restart the server.
- The unit is wrong (
GBinstead ofG). - The machine is running 32-bit Java (more on that below).
If you're still setting the server up, how to make a modded Minecraft server walks through the install first.
ATLauncher and CurseForge server packs
ATLauncher's server memory defaults to 2GB. In the launcher, open the Servers tab, hit "Open Folder", and find the LaunchServer script. On Windows, edit set maxmemory=2G near the top (to 8G, say). On Linux and macOS, edit MEMORY="2G". Save it, and the change applies on the next start.
CurseForge packs don't share one setup. There's no universal file name, because it's up to whoever built the server pack. Look in the server folder for a start script, a run.bat or run.sh, or a user_jvm_args.txt. If there's only a run.bat, open it: it either has the java line itself or calls another script that does. Change the -Xmx and -Xms numbers there. If you can't find anything, read the pack's readme or ask the pack author. Hosts that run a pack for you usually have a memory setting in their panel instead.
Hosted servers: Aternos, Minehut and paid hosts
Aternos
You can't pick your RAM on Aternos. It depends on the software and version you run. A vanilla 1.20.1 server, for example, gets 2400MB. Modded servers and newer versions get more. You can see what your server has on the server page at aternos.org/server while it's online. Java can show most of that as "used" even when it isn't short, and an offline server uses none.
Switching software just to get more memory isn't worth it. Aternos itself points to Paper or Purpur for the best performance, even on less memory. There's also a RAM boost through a Medal partnership, where you install Medal and record a Minecraft clip. It's a promotion, so check whether it's still running. For more control, Aternos has a paid sister platform, exaroton. My Aternos alternatives roundup covers other routes.
Minehut
Minehut's free servers get 1GB of RAM and 10 player slots, and you can have up to five. More memory means a paid plan: log in, go to Store, then Server Plans, subscribe, pick the server and continue. There are custom plan options on the server dashboard too. If the server's running during the upgrade, hibernate it and start it again for the change to apply.
Paid hosts
On a typical paid Minecraft host, RAM is part of your plan. You upgrade the plan, or change a memory field in the control panel if there is one. Don't hunt for a start script, because you often don't have one. If you can't find the setting, ask support. If you've rented a VPS instead, the host gives you the machine's RAM and you set -Xmx yourself, and you'll need to update it when you buy more. Not sure what each tier costs? That's covered in how much a Minecraft server costs, and the modded hosting roundup compares hosts for packs.
Don't give Java all your RAM
This one gets people. If your machine or host has 8GB, don't set -Xmx8G. Java and Minecraft need memory beyond the heap, and the OS needs some too. Paper's docs say to knock 1000 to 1500MB off the number, so 6500MB on an 8GB box. Go over and you risk running out of memory, or the operating system killing the server outright.
More isn't automatically better either. Paper notes that past a certain point extra memory just wastes money. For how much you actually need, see the cost guide.
The 32-bit Java problem
32-bit Java can't use a big heap. A couple of GB at most, and a bigger -Xmx can stop the JVM from starting with an error like "Could not reserve enough space for object heap". Run java -version and look for 64-Bit Server VM. If it doesn't say that, install 64-bit Java and make sure your script (or your PATH) points at it.
How to confirm the change took
- No JVM error at launch. A bad value fails right away. If the server starts without a memory error, Java accepted the numbers.
- The panel meter. On Aternos the RAM figure sits on the server page while the server's online. Paid hosts usually have a similar readout in their panel.
- spark. Install spark and run
/spark health show --memoryin the console for a report that includes JVM memory use./spark healthopens a live dashboard with TPS, CPU, memory and disk.
Windows Task Manager can show the Java process using a bit more than your -Xmx. That's normal, since the heap isn't the only thing Java uses.
When more RAM won't fix your lag
Memory trouble and CPU trouble look alike: lag, slow chunk loading, the occasional crash. But Minecraft servers mostly run on one core, so lag with plenty of free memory usually points at the CPU or a plugin, not RAM. Throwing RAM at it does nothing, and an oversized heap can make garbage collection pauses longer on Java 8.
Tell them apart instead of guessing. /spark tps shows TPS and CPU use, /spark gc shows garbage collection history, and the spark profiler (/spark profiler start, then stop) shows what's eating the tick. If the CPU is pinned, the Minecraft Wiki's fixes are the usual ones: kill excess entities, lower view-distance and simulation-distance in server.properties (see server.properties explained), and if that's not enough, get a CPU with better single-thread speed.
FAQ
How do I add more RAM to a Forge server?
Uncomment and edit the -Xmx line in user_jvm_args.txt, then start the server with run.bat or run.sh.
Why is my server still using 2GB?
Usually the # is still on the line, you're launching it a different way, or you skipped the restart. See the checklist above.
Can I add more RAM on Aternos?
Not by setting it yourself. Aternos assigns RAM by software and version, with a promotional Medal boost and a paid sister platform for more.
Is more RAM always better?
No. Leave 1000 to 1500MB for the OS and Java overhead, and if the lag is CPU-bound, memory won't help.