“How much RAM do I need?” is the first question for anyone hosting a Minecraft server, and the honest answer is: less than you think for vanilla, more than you think for big modpacks, and the CPU matters just as much. Here’s how to size it.
Quick answer
| Server type | Players | RAM for Minecraft (-Xmx) |
VPS total RAM |
|---|---|---|---|
| Vanilla / Paper, small | 1–5 | 2–3 GB | 4 GB |
| Paper with plugins | 5–20 | 4–6 GB | 6–8 GB |
| Paper, busy | 20–50 | 6–10 GB | 8–12 GB |
| Light modded (≤ 50 mods, Fabric) | 1–10 | 4–6 GB | 6–8 GB |
| Medium modpack (100–200 mods) | 1–10 | 6–10 GB | 8–12 GB |
| Large kitchen-sink modpack (300+ mods) | 1–10 | 10–14 GB | 16 GB |
| Bedrock Dedicated Server | 1–10 | — (native, ~1–2 GB) | 2–4 GB |
“VPS total RAM” leaves headroom for the operating system, backups, and other tools. Never give Java all of the server’s memory.
What actually uses the RAM
- Loaded chunks: each player loads chunks around them (
view-distance). Players spread out across the map cost far more than players together at spawn. - Entities: mob farms, item piles and villagers.
- Mods and plugins: each adds classes, data and caches. Big modpacks start at 4–6 GB before anyone joins.
- World generation: exploring new terrain is expensive. Pre-generating the world helps a lot.
Setting -Xmx and -Xms correctly
java -Xms6G -Xmx6G -jar server.jar --nogui
-Xmxis the maximum heap.-Xmsis the initial heap. Setting them equal avoids resizing pauses.- Java uses some memory beyond the heap (metaspace, threads, native buffers). Expect the process to use 0.5–1.5 GB more than
-Xmx. - Use the G1 garbage collector with “Aikar’s flags” for Paper and most modpacks. See Paper server setup.
Why more RAM isn’t always better
- Garbage collection pauses get longer with huge heaps that aren’t needed. A 6 GB vanilla server often runs smoother than a 16 GB one.
- RAM doesn’t fix CPU-bound lag. Minecraft’s main game loop runs mostly on one thread. If TPS (ticks per second) drops below 20 while RAM is fine, you need a faster CPU, not more memory.
- Over-allocating can starve the operating system, and cause swapping or out-of-memory kills.
CPU matters as much as RAM
| Symptom | Likely bottleneck |
|---|---|
| “Can’t keep up! Is the server overloaded?” in logs, TPS < 20 | CPU (single thread) |
| Long freezes, then catch-up | GC pauses (heap too small or too large) |
Server crashes with OutOfMemoryError |
Heap too small for the pack and world |
| Process killed suddenly (no Java error) | OS ran out of memory: the OOM killer |
Check with htop (CPU per core, and memory), /spark tps and /spark profiler (with the spark plugin or mod), and journalctl -k | grep -i oom. See htop and Linux OOM killer.
Reduce RAM and CPU needs
- Lower view-distance (8) and simulation-distance (6) in
server.properties. - Pre-generate the world with Chunky, and set a world border.
- Use Paper (or Purpur) instead of vanilla for plugin servers, and performance mods (Lithium, FerriteCore, ModernFix) for Fabric or NeoForge packs.
- Limit entities, and clear lag machines.
- Restart daily. Some modpacks leak memory.
Add swap as a safety net
A swap file won’t make Minecraft faster, but it can prevent sudden OOM kills during spikes:
sudo fallocate -l 2G /swapfile && sudo chmod 600 /swapfile
sudo mkswap /swapfile && sudo swapon /swapfile
When to upgrade
- Memory use stays close to
-Xmxand GC runs constantly → more RAM. - TPS drops under load while RAM is fine → faster CPU, or a lighter configuration.
- You add a big modpack, or player count doubles → re-size using the table above.
With a VPS, upgrading means moving to a larger plan. On VPS.DO, plan upgrades are handled through a support ticket. See game server VPS and how much RAM a VPS needs.
Quick reference
| Item | Rule of thumb |
|---|---|
| Small vanilla/Paper | 2–4 GB heap |
| Plugin server, 20+ players | 6–10 GB heap |
| Big modpack | 10–14 GB heap |
| OS headroom | 1–2 GB beyond -Xmx |
| Lag with free RAM | CPU-bound: faster cores |
Related: modded Minecraft server and Minecraft Java server on Linux.