FREE MINECRAFT TOOL

Minecraft Server Startup Flags Generator

For most Paper, Purpur, Fabric and Vanilla servers, use Aikar's G1 flags with -Xms and -Xmx set to the same value, leaving part of the plan's memory outside the heap (PaperMC suggests 1–1.5 GB on larger plans). Pick your memory, Minecraft version and software to get the exact command.

Loading flags generator...

Which Java version does your server need?

Minecraft versionMinimum Java
26.1 or newerJava 25
1.20.5 – 1.21.xJava 21
1.18 – 1.20.4Java 17
1.17.xJava 16
1.12 – 1.16.5Java 8

An older Java refuses to start a newer Minecraft server with an UnsupportedClassVersionError. Newer Java usually runs older Paper builds, but old Forge versions expect Java 8.

What the flags change

  • G1NewSizePercent and G1MaxNewSizePercent give the young generation 30–40% of the heap (40–50% above 12 GB), because Minecraft creates a huge number of short-lived objects.
  • MaxTenuringThreshold=1 and SurvivorRatio=32 stop temporary data from being copied around and promoted to the old generation.
  • G1HeapRegionSize=8M (16M on large heaps) raises the size at which allocations count as "humongous" and go straight to the old generation.
  • DisableExplicitGC ignores plugins that call System.gc(), which would otherwise trigger a full collection and a lag spike.
  • AlwaysPreTouch reserves the whole heap at startup, so the server starts a little slower but does not stall later while the OS hands over memory.

-Xms and -Xmx explained

-Xmx is the maximum heap: the most memory the Minecraft world, entities, chunks and plugins may occupy inside Java. -Xms is the initial heap. For a dedicated server set both to the same value so the collector works with a fixed heap instead of growing and shrinking it. The heap is not the whole process: Java also needs memory for metaspace, threads, native buffers and the collector itself, which is why the generator leaves part of the plan outside the heap. A -Xmx equal to the plan's full memory is the most common way to get a server killed for exceeding its limit.

Memory allocation mistakes

  • Heap equal to the container limit. Leave headroom: about 15% on small plans, 1–1.5 GB on large ones.
  • Huge heap for a small server. A 24 GB heap for five players does not make ticks faster; it makes collections rarer and longer. Size from the RAM calculator and the RAM requirements guide, not from what the plan allows.
  • Different -Xms and -Xmx "to save memory". The server will grow to -Xmx anyway under load; a smaller -Xms only adds resizing work.
  • Flags copied from a different Java version. Options that existed in Java 8 are removed or renamed in Java 17 and 21; the generator only emits flags valid for the Java your Minecraft version needs.
  • Expecting flags to fix tick lag. Flags shorten garbage-collection pauses. If MSPT is high between pauses, the cause is in the workload: follow the Minecraft server lag guide.

Modern Java caveats

Aikar's flags were tuned for G1 on Java 8 through 21 and remain PaperMC's recommendation. On Java 21 and newer, generational ZGC is an alternative that can shorten pauses on large heaps with spare CPU cores, at the cost of more CPU and memory; try it only when a profiler shows garbage collection in your lag spikes, and compare MSPT under the same load. Newer Java runs older Paper builds fine, but very old Forge versions expect Java 8, and a Java that is too old for your Minecraft version fails with UnsupportedClassVersionError before any flag is read.

Frequently asked questions

What are Aikar's flags?

Aikar's flags are a set of G1 garbage collector settings tuned for Minecraft's high allocation rate. They give the young generation more room, keep short-lived objects from being promoted and stop plugins from forcing full garbage collections. PaperMC publishes and recommends them.

Should -Xms and -Xmx be the same?

Yes for a dedicated Minecraft server. The server should be able to use its whole heap anyway, and G1 works better with all of it available from the start. Setting both to the same value also makes AlwaysPreTouch reserve the memory at startup.

Why is the heap smaller than my plan's memory?

Java uses memory outside the heap for metaspace, threads, network buffers and the garbage collector itself. If -Xmx equals the container limit, the process can exceed it and be killed. PaperMC suggests leaving about 1000–1500 MB outside the heap; on small plans the generator leaves 15%, at least 256 MB.

Do startup flags fix lag?

They reduce garbage collection pauses, which removes one cause of lag spikes. They do not make a slow tick faster: if MSPT stays above 50 ms, the cause is usually entities, chunk generation, redstone or plugins. Measure with spark and the TPS/MSPT calculator before changing hardware or flags.

Should I use ZGC instead of G1?

G1 with Aikar's flags is the tested default for Minecraft. Generational ZGC (Java 21+) can shorten pauses on large heaps when the server has spare CPU cores, but it uses more CPU and memory. Try it only if GC pauses show up in your profiler, and compare MSPT with both.

Where do I put the flags for Forge or NeoForge?

Forge and NeoForge for Minecraft 1.17 and newer start with run.sh or run.bat. Put the flags in user_jvm_args.txt, one per line, and leave the -jar part out. Older Forge versions start from the Forge jar with a normal java command.