Aikar's Flags Generator for Minecraft Servers
Aikar’s flags are the JVM garbage-collection settings recommended by the Paper team for Minecraft servers. Enter your RAM and jar file name to get the full start command and a script for Linux or Windows.
Settings
What are Aikar’s flags?
Minecraft servers run on Java, and Java frees unused memory with a garbage collector. With default settings, the collector can pause the whole server for a moment, and players feel those pauses as lag spikes and rubber-banding. Aikar, a long-time Paper developer, tuned Java’s G1 collector for the way Minecraft uses memory: lots of short-lived objects created every tick. His settings, known as Aikar’s flags, keep pauses short and regular. PaperMC’s documentation recommends them for every Paper server.
What the main flags do
| Flag | What it does |
|---|---|
-Xms / -Xmx | The starting and maximum memory for the server. Set both to the same value so Java reserves it all at startup. |
-XX:+UseG1GC | Uses the G1 garbage collector, which works in small regions and keeps pauses short. |
-XX:MaxGCPauseMillis=200 | Asks the collector to keep each pause under 200 ms. |
-XX:G1NewSizePercent / G1MaxNewSizePercent | Reserves a large part of memory for new, short-lived objects, which is how Minecraft creates most of its data. |
-XX:+AlwaysPreTouch | Touches all the memory at startup so the system doesn’t have to hand it over during play. |
-XX:+DisableExplicitGC | Ignores plugins that ask Java to run a full garbage collection, which would freeze the server. |
-XX:MaxTenuringThreshold=1 | Moves objects that survive one collection out of the young area quickly, keeping young collections fast. |
How much memory to give the server
Don’t give Java all the RAM your machine has. Java itself, the operating system and any other programs need room too. PaperMC’s advice is to leave about 1,000–1,500 MB free: on a machine or VPS with 8 GB, use about 6.5 GB for the server. Tick “Leave 1.5 GB for the system” above to do this automatically.
On a game host, the plan’s RAM is usually what the server is allowed to use, and the host’s panel already sets -Xmx. Many hosts have an “Aikar’s flags” option or a field for extra startup flags in their panel.
Above 12 GB, Aikar’s original guide changes a few values (a larger young generation and 16 MB regions). The generator switches to those automatically. More memory isn’t always better, though: past what your server needs, a bigger heap just means larger, slower collections.
How to use the script
- Put
start.shorstart.batin the same folder as your server jar. - On Linux or macOS, make it executable once with
chmod +x start.sh, then run./start.sh. - On Windows, double-click
start.bat. - Use the Java version your Minecraft version needs: Minecraft 26.1 and newer need Java 25, and 1.20.5 to 1.21.x need Java 21.