Cloud VPS from $1.98/mo · pay with Bitcoin, Ethereum, Monero, USDT or Solana · paid in crypto
Gaming

Minecraft RAM: how much you need and how to set it

How much RAM a Minecraft server or client needs, how to set -Xms and -Xmx on Java 25, and how to tell whether more memory will fix lag at all.

CloudSat teamNovember 18, 20267 min read
A row of memory modules drawn as stacked grass blocks, with a gauge needle hovering just below the red zone.
On this pageWhat actually uses the memory

"Give it more RAM" is the first advice anyone gets for a struggling Minecraft server, and it is right less often than people think. Memory decides how many chunks, entities and mods fit in the game at once. Speed, measured in milliseconds per tick, mostly depends on one fast CPU core. This guide sizes memory for the server and the game client, shows how to set it on Java 25, and explains how to tell a memory problem from a CPU problem before you pay for a bigger plan.

What actually uses the memory

A Java server keeps its world in the heap, the memory pool you size with -Xmx. The heap holds:

  • Loaded chunks. Every online player keeps a square of chunks loaded around them, set by view-distance and simulation-distance in server.properties. Ten players spread across the map load far more than ten players standing at spawn.
  • Entities. Mobs, villagers, item frames, dropped items and minecarts all live in memory, and big farms multiply them.
  • Mods and plugins. Each mod adds blocks, items, recipes and code. A pack with 300 mods can need several gigabytes before the first player joins.

The Java process also uses memory outside the heap: loaded classes, thread stacks, network buffers and the garbage collector's own bookkeeping. That is why the process shown by top grows past the -Xmx value, and why the heap should never take all of the machine's RAM.

Starting points by workload

These are rules of thumb to start from, not guarantees. Measure afterwards and adjust.

Workload Heap (-Xms and -Xmx) Server memory
Vanilla or Paper, a few friends 2 to 3 GB 4 GB
Paper with plugins, 10 to 30 players 4 to 6 GB 8 GB
Light modpack, under 100 mods 4 to 6 GB 8 GB
Large modpack, 200 mods or more 8 to 10 GB 12 to 16 GB
Several servers behind a proxy Add each server's heap Sum of heaps plus 1 to 2 GB

PaperMC's own documentation goes further and suggests 6 to 10 GB for any player count, because the G1 garbage collector works best with headroom. Small private worlds run well below that, but if you have the memory, a heap in that range costs nothing in performance.

On the operating system side, leave room: Paper's guide recommends setting the heap about 1,000 to 1,500 MB below the memory limit of the machine or container, so Java's own overhead and the system both fit. On a 4 GB server, a 3 GB heap on a minimal Linux install is the practical ceiling.

Set the heap on a server

Minecraft 26.1 and later need Java 25, while 1.20.5 to 1.21.11 run on Java 21. Check with java -version, then start the server with the same value for the minimum and maximum heap:

java -Xms4G -Xmx4G -jar server.jar nogui

Setting -Xms equal to -Xmx means the JVM reserves its memory at boot instead of growing and shrinking the heap while players are online.

Name the garbage collector explicitly, too. Java only picks G1 by itself on machines it considers server class, with at least two CPUs and about 2 GB of memory; on a single-vCPU server it falls back to the serial collector, which pauses the whole game for every collection:

java -Xms6G -Xmx6G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:+AlwaysPreTouch -jar paper.jar --nogui

Paper servers usually add the full G1 tuning set that PaperMC publishes as Aikar's flags. Copy it from that page rather than from forum posts, because the documented set is the one kept current for recent Java releases.

Put the command in a start.sh script or a systemd unit so the value survives restarts and nobody types a different number by hand. If you run the server through a panel such as Pterodactyl or PufferPanel, set memory in the panel instead: it passes its own limit to Java, and a mismatch between the container limit and -Xmx gets the process killed.

Changing the size later

Stop the server, edit the two values, start it again. Java cannot resize a running heap past -Xmx, so there is no live change. On a CloudSat High Frequency VPS, resizing to a bigger plan keeps the disk, the IP and the world, after which you raise -Xmx to match.

Set memory for the game client

The client has its own heap, and players running modpacks often need to raise it.

  1. In the official Minecraft Launcher, open Installations.
  2. Hover over the installation, open the three-dot menu and choose Edit.
  3. Click More options and find -Xmx2G at the start of JVM arguments.
  4. Change it to -Xmx4G for vanilla with shaders or a light pack, or -Xmx6G to -Xmx8G for a large pack, then save.

Modded launchers such as the CurseForge app, Prism Launcher and the Modrinth App replace that text field with a memory slider in their settings, either globally or per instance. Whatever the launcher, keep the allocation to roughly half of the computer's RAM so Windows, the browser and voice chat still have room. A system that starts swapping to disk stutters far worse than a client with a slightly smaller heap.

Find out what the server really uses

Operating system tools show the whole process, which looks full by design when -Xms equals -Xmx:

free -h
ps -C java -o pid,rss,etime,cmd

To see inside the heap, use the spark profiler, bundled with Paper since 1.21 and available as a mod for Fabric and NeoForge:

spark health
spark gc
spark heapsummary

spark health reports ticks per second, milliseconds per tick, CPU and memory together, which makes it the fastest first check. Read the result like this:

  • Heap after garbage collection keeps climbing toward the limit, or the log shows java.lang.OutOfMemoryError: the server needs more memory, or a mod is leaking it.
  • Collections run constantly and each frees very little: the heap is too small for the world and mod list.
  • Heap is comfortable but milliseconds per tick sit above 50: memory is not your problem. More RAM will not change anything.

When more RAM will not fix the lag

The main game loop runs on a single thread and must finish each tick in 50 ms to hold 20 ticks per second. The usual reasons it fails are work, not memory:

  • Chunk generation while players explore new land. Pre-generate the map with a tool such as Chunky and set a world border.
  • Entity piles from mob farms, item overflows and breeding pens. Count them with spark and cap them with game rules or plugin limits.
  • High view and simulation distances. Dropping simulation-distance from 10 to 6 cuts the area where crops, mobs and redstone are processed while players still see far.
  • A slow CPU core. Clock speed and per-core performance matter more than core count for a single world.

A profiler report from spark profiler start, left running through a laggy period and stopped with spark profiler stop, shows exactly which of these is eating the tick.

FAQ

What happens if I give Minecraft too much RAM?

On the server, a large heap is harmless as long as the operating system keeps enough memory; trouble starts when the machine has to swap. On a gaming PC, an oversized client allocation starves everything else and causes the stutter people blame on "too much RAM".

Why does my server use more memory than -Xmx?

Because the heap is only part of the Java process. Classes, threads, network buffers and the garbage collector live outside it. Plan for several hundred megabytes to more than a gigabyte of overhead, more with large modpacks.

Does a Bedrock server need these settings?

No. Bedrock Dedicated Server is native code, not Java, so there is no -Xmx to set. Its memory use follows the world size, the view distance and the player count.

How much RAM does a 1.12.2 modpack need?

Plan for the same heap as a modern pack of similar size, and remember that most 1.12.2 packs need Java 8 rather than Java 21 or 25. Keep each Java version installed side by side and point each server at the right one.

Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.