How Much RAM Does a Minecraft Server Need?

Updated · MCJarHub

Rules of thumb: a proxy needs 512 MB–1 GB, a small Paper or vanilla server for friends 2–4 GB, a public server or light modpack 6–10 GB, and large modpacks more. Always leave 1–1.5 GB for the operating system: on an 8 GB machine, give the server about 6.5 GB.

Rules of thumb

There is no exact formula — memory use depends on view distance, how spread out players are, loaded chunks, entities, plugins and mods. Treat these as starting points, then watch real usage:

ServerStarting point for -Xmx
Proxy (Velocity, BungeeCord)512 MB – 1 GB
Vanilla or Paper, a few friends2 – 4 GB is enough for many small servers
Paper public server / SMP with plugins6 – 10 GB
Light modpack (Fabric, NeoForge)6 – 8 GB
Large modpack (hundreds of mods)8 – 12 GB or more

More is not automatically better: past a certain point extra memory brings diminishing returns, and lag is more often caused by CPU load (entities, redstone, chunk generation) than by a lack of RAM. PaperMC's own guidance for its tuned setup is at least 6–10 GB "no matter how few players", because the G1 garbage collector works better with room to spare — if you have the memory, give it. The RAM calculator turns these rules into a suggestion for your setup.

Never give Java all of the machine's memory

Java uses memory on top of the -Xmx heap (threads, native libraries, garbage-collector bookkeeping), and the operating system needs some too. PaperMC's advice: reduce -Xmx by about 1000–1500 MB below what the machine or hosting plan has. With 8 GB, use about 6.5 GB (-Xmx6500M). Otherwise the system may start swapping or the out-of-memory killer ends the server process.

If you play on the same PC, subtract what the game and your other programs need as well.

-Xms and -Xmx

  • -Xmx is the maximum heap; -Xms the heap reserved at start.
  • For a dedicated server set them to the same value, as PaperMC recommends: the server will use the whole heap over time anyway, and a fixed heap avoids resizing.
  • Units: M for megabytes, G for gigabytes — -Xmx6G or -Xmx6144M.
java -Xms6G -Xmx6G -jar server.jar nogui

Forge 1.17+ and NeoForge read memory settings from user_jvm_args.txt instead of the command line.

Aikar's G1 flags

With several GB of heap, PaperMC recommends Aikar's garbage-collector flags, which keep pauses short. They work for Paper, Purpur, Folia and generally for vanilla and modded servers on modern Java:

java -Xms6G -Xmx6G -XX:+AlwaysPreTouch -XX:+DisableExplicitGC -XX:+ParallelRefProcEnabled -XX:+PerfDisableSharedMem -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1HeapRegionSize=8M -XX:G1HeapWastePercent=5 -XX:G1MaxNewSizePercent=40 -XX:G1MixedGCCountTarget=4 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1NewSizePercent=30 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:G1ReservePercent=20 -XX:InitiatingHeapOccupancyPercent=15 -XX:MaxGCPauseMillis=200 -XX:MaxTenuringThreshold=1 -XX:SurvivorRatio=32 -jar server.jar nogui

Every Paper, Purpur and Folia page on MCJarHub includes a start script with these flags, and the start script generator builds one for your RAM and OS.

How to tell whether you have enough

  • The server log shows java.lang.OutOfMemoryError or the process is killed by the system: too little heap, or too much for the machine.
  • Regular long pauses or "Can't keep up!" messages together with a nearly full heap: more memory may help; if the heap has room, look for CPU causes instead.
  • On Paper, the built-in /spark profiler (bundled since 1.21) and the /tps command show memory, garbage collection and tick time.

Related: how to run a server jar · make a server from scratch.

FAQ

Does more RAM mean less lag?
Only up to a point. Lag usually comes from CPU-heavy things (entities, redstone, chunk generation). PaperMC notes that beyond a certain amount extra memory gives diminishing returns.
Why does my server use more RAM than -Xmx?
Java needs memory outside the heap (threads, native libraries, metaspace), so the process always uses somewhat more than -Xmx.