FreeGameHost.xyz

How to Allocate More RAM to a Minecraft Server (Fix Server Lag)

By FreeGameHost Team  •  Updated May 2026  •  6 min read

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 →

How Much RAM Do You Actually Need?

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.

Method 1: How to Allocate RAM on a Local PC Server

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).

  1. Right-click your start.bat file and select Edit (this will open it in Notepad).
  2. You will see a line of code that looks something like this:
java -Xmx1024M -Xms1024M -jar server.jar nogui

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:

java -Xmx4096M -Xms4096M -jar server.jar nogui

Save the Notepad file, double-click the start.bat file again, and your server will boot up with 4GB of RAM.

Troubleshooting: If the server immediately closes after changing this, it means you installed the 32-bit version of Java. You must uninstall it and download Java 64-bit to allocate more than 1GB of RAM.

Method 2: How to Allocate RAM on a Hosted Server

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):

  1. Log into your server panel.
  2. Go to the Startup tab on the left-hand menu.
  3. Look for the variables labeled Server Memory, Maximum RAM, or the JVM Flags section.
  4. Adjust the value to your desired limit. (Note: You cannot exceed the maximum limit assigned to your plan).
  5. Restart your server.

The Big Problem: "My Host Won't Let Me Allocate More!"

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.

Frequently Asked Questions

What is the difference between Xmx and Xms?
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.
Will adding more RAM fix my TPS?
It depends. If your TPS (Ticks Per Second) drops because you ran out of memory, adding RAM will fix it. However, if your TPS is low because of a massive entity farm (too many mobs) or a badly coded plugin, you are experiencing a CPU bottleneck. More RAM will not fix a CPU issue.

Stop paying for RAM upgrades. Get 4GB RAM completely free today.

Create Your 4GB Server Free →