Minecraft server startup flags generator

Aikar's flags with your memory filled in, and a start script ready to copy.

Where it runs

Java needed: Java 21

Flag set: Aikar's standard

start.sh
#!/bin/sh
java -Xms6G -Xmx6G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseIntervalMillis=100 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar paper.jar nogui
  • • Make it executable with chmod +x start.sh, then run ./start.sh.
  • • Leave 1–2 GB of the machine's memory free for the operating system.
Beacon Hosting logo

Recommended host

Beacon Hosting

Get a 6 GB server →

What each flag group does

-Xms / -Xmx
Minimum and maximum memory, set the same so Java takes all of it once and never resizes the heap.
G1GC and pause target
Use the G1 garbage collector and aim for short pauses, so memory cleanup doesn't cause lag spikes.
G1 sizing flags
Tune G1 for Minecraft, which makes huge numbers of short-lived objects every tick.
DisableExplicitGC, AlwaysPreTouch
Stop plugins forcing a full cleanup, and reserve the memory up front at startup.
PerfDisableSharedMem
Stop Java writing stats to disk, which can stall the server on slow disks.

Why startup flags matter

Java's default settings are made for general programs, not a game server that creates millions of short-lived objects every second. Without tuning, memory cleanup can freeze the server for a moment, which players feel as lag spikes.

Above 12 GB, the generator switches to Aikar's large-heap variant, which gives the collector bigger regions and more room for new objects.

Frequently asked questions

What are Aikar's flags?

A set of Java garbage-collection settings tuned for Minecraft servers by Aikar, and recommended by PaperMC. They reduce lag spikes caused by Java cleaning up memory.

Should -Xms and -Xmx be the same?

Yes, for a dedicated server. Setting both to the same value means Java reserves all its memory at startup and never spends time growing or shrinking the heap.

Which Java version does my Minecraft server need?

Minecraft 1.20.5 to 1.21.x needs Java 21, 1.18 to 1.20.4 needs Java 17, and 1.16.5 and older run on Java 8. The newest releases need a newer Java again; the generator shows the right one for each version.

How do I make a start.bat for a Minecraft server?

Pick Windows above, copy the start.bat contents into a file named start.bat in your server folder, and double-click it. The pause line keeps the window open so you can read any errors.

Do Aikar's flags work with Forge and Fabric?

Yes. They work with any Java server. For Forge and NeoForge on 1.17 and newer, put them in user_jvm_args.txt instead of the start command.

Guides

Embed this tool

Add it to your guide, wiki or forum post for free. Paste this where you want it to appear:

HTML
<iframe src="https://spawnkit.dev/embed/startup-flags" width="100%" height="1100" style="border:0" loading="lazy" title="Minecraft server startup flags generator"></iframe>

More setup tools