Tools · Hosting

Aikar Flags Generator

Garbage collection pauses cause Minecraft tick lag. Aikar's G1GC flags are the community standard — set heap size, copy the command, paste into your startup script.

On a dedicated VPS, set -Xms and -Xmx to the same value. Order at least 8 GB total RAM (6 GB heap + ~2 GB for the OS). Not sure how much heap? Use the RAM calculator first.
Startup command
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:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -jar paper.jar nogui

Put this in your start.sh, Pterodactyl startup command, or systemd unit.

JVM flags only · what each group does
-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:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1

G1 Garbage Collector

Uses G1GC tuned for low pause times — the standard for Paper/Spigot since 2019.

Experimental & GC tuning

AlwaysPreTouch pre-allocates heap pages at startup to avoid runtime page faults. DisableExplicitGC prevents plugins from forcing full GCs.

G1 heap sizing

Controls young generation ratios and region size for Minecraft's allocation patterns.

Mixed GC & tenuring

Fine-tunes when mixed collections start and how objects tenured to old gen.

Why Paper servers use Aikar flags

Minecraft allocates millions of short-lived objects every tick. Default JVM GC settings cause stop-the-world pauses that drop TPS below 20. Aikar flags configure G1GC to collect in small increments.

The flags do not replace adequate RAM — they make existing RAM perform more consistently. Size heap first with the RAM calculator, then apply flags.

Sizing -Xms and -Xmx before copying flags

Rule of thumb: VPS total RAM minus 1.5 GB equals safe -Xmx. An 8 GB VPS gets -Xmx6G. Match -Xms on dedicated hosts where Minecraft is the only major process.

Key JVM flags in the generated command

FlagPurpose
-Xms / -XmxInitial and max Java heap size
-XX:+UseG1GCG1 garbage collector — best for Minecraft heaps 4G+
-XX:MaxGCPauseMillis=200Target max GC pause to protect 20 TPS
-XX:+AlwaysPreTouchPre-allocate heap pages at startup
-XX:G1HeapRegionSize=8MOptimal G1 region size for 4G+ heaps
-XX:+ParallelRefProcEnabledParallel reference processing during GC

How to use this tool

  1. 1

    Set your heap size in GB

    Enter the RAM allocated to Minecraft — typically VPS total RAM minus 1.5 GB. Use the RAM calculator if you are unsure. Match -Xms and -Xmx to the same value on dedicated hosts.

  2. 2

    Copy the startup command

    Copy the full java command including -Xms, -Xmx, G1GC flags, and -jar paper.jar nogui. Use "Set Xmx = Xms" if the generator shows different values.

  3. 3

    Paste into your start script

    Replace the java line in start.sh, your hosting panel startup field, or systemd service. Restart the server and verify with /spark gc or your host memory graph.

Frequently asked questions

What are Aikar flags for Minecraft?

Aikar flags are JVM arguments tuned for Minecraft garbage collection by Timings developer Aikar. They configure G1GC to minimise tick lag from GC pauses. Most Paper hosting guides recommend them as default startup flags.

Should -Xms and -Xmx be the same value?

On a dedicated VPS running only Minecraft, yes. Matching them prevents heap resize lag spikes. Set both to target heap — typically VPS RAM minus 1.5 GB for the OS.

How much RAM should I put in -Xmx?

Depends on player count, plugins, and world size. A 20-player Paper SMP typically needs 4–6 GB heap. Use the RAM calculator, then paste that number here. Never set -Xmx to 100% of VPS RAM.

Do Aikar flags work on Forge and Fabric?

G1GC tuning helps any Java Edition server including modded. Modpacks need larger heaps (8–16 GB) but the flag structure is the same. Bedrock does not use the JVM.

Where do I paste the generated startup command?

Into start.sh, systemd service, or hosting panel startup field. On Pterodactyl paste into Startup tab. On AMP use JVM Arguments plus separate memory setting.

What Java version should I use with Aikar flags?

Java 21 LTS is recommended for Minecraft 1.20.5+ and 1.21. Paper publishes builds targeting specific Java versions — check the download page.

Will Aikar flags fix low TPS?

They reduce GC-related lag spikes but do not fix CPU overload from plugins, redstone, or low view distance. High MSPT from chunk generation needs more CPU or lower view-distance — check the TPS calculator.

Can I use these flags on shared hosting?

Many shared hosts set JVM args for you and disallow custom flags. VPS and dedicated servers where you control start.sh are where Aikar flags matter most.

Related tools