If your Minecraft server is constantly lagging, rubberbanding, or randomly crashing with a java.lang.OutOfMemoryError in the console, your server is starving for resources. By default, standard Minecraft servers only allocate 1GB to 2GB of RAM which is rarely enough for modern updates.
In this guide, we will show you exactly how to allocate more RAM to your Minecraft server, whether you are hosting it locally on your own PC, or renting from a server host.
Is your current host forcing you to pay for more RAM?
Switch to FreeGameHost for 4GB Free →Before changing your settings, you need to know how much memory to allocate. Adding too little won't fix your lag, but adding too much can actually cause Java's "Garbage Collection" process to stutter, making lag worse.
If you are running the server from a folder on your own Windows computer, you control the RAM via the startup batch file (usually named start.bat or run.bat).
start.bat file and select Edit (this will open it in Notepad).The numbers after -Xmx (Maximum RAM) and -Xms (Starting RAM) dictate your memory allocation. To increase this to 4 Gigabytes (4096 Megabytes), simply change the values:
Save the Notepad file, double-click the start.bat file again, and your server will boot up with 4GB of RAM.
If you are using a hosting company (like FreeGameHost, Apex, or Nodecraft), you cannot edit the start.bat file directly. Instead, memory is controlled through the host's control panel.
On Pterodactyl-based panels (like FreeGameHost):
If you are using free hosts like Aternos or Minehut, you've likely hit a paywall. Aternos heavily restricts RAM based on network load, and Minehut strictly caps free users at 1GB of RAM. If you try to run anything beyond basic vanilla, your server will lag constantly, and they will prompt you to pay for an upgrade.
The Solution: You don't have to pay. Move your world to FreeGameHost. We give every free server a dedicated 4GB of RAM and 200% CPU allocation right out of the box. No credit cards, no hidden upgrades, and no queues to start your server.
Xms is the initial amount of RAM the server claims when it boots up. Xmx is the maximum amount of RAM the server is allowed to use if it needs it. It is generally recommended to set both to the exact same number to prevent lag spikes caused by the server constantly resizing its memory pool.Stop paying for RAM upgrades. Get 4GB RAM completely free today.
Create Your 4GB Server Free →