Best Aikar JVM Flags for a Minecraft Server
Aikar's JVM flags tune Java's garbage collector for Minecraft, smoothing out stutter. Here's the full flag set and how to use it.

Aikar's flags are a well-known set of JVM arguments that tune Java's garbage collector for Minecraft. They don't magically boost TPS, but they smooth out the periodic stutter caused by garbage-collection pauses. Here's the exact flag set and how to apply it.
What the flags actually do
Minecraft servers create and discard huge numbers of short-lived objects each tick. The default JVM garbage collector handles this in a way that causes occasional long pauses — you see them as a freeze every so often. The flags switch to the G1 garbage collector with settings tuned so it collects in small, frequent, predictable steps instead of rare big ones.
The flag set
Here is the standard Aikar flag set. The two numbers you change are -Xmx and -Xms (set them equal to each other):
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 server.jar nogui

Set Xms equal to Xmx
This is important and counter-intuitive. Set the minimum and maximum heap to the same value (-Xms6G -Xmx6G). It avoids the JVM constantly resizing the heap and, with AlwaysPreTouch, commits the memory up front for steadier performance.
For large heaps (12 GB+)
If you allocate more than 12 GB, Aikar recommends two changes: bump the region size and lower two of the percentages:
-XX:G1HeapRegionSize=16M
-XX:G1NewSizePercent=40
-XX:G1MaxNewSizePercent=50
-XX:InitiatingHeapOccupancyPercent=20
But don't over-allocate — see how much RAM a server really needs. A bloated heap means longer collection cycles, not more TPS.
Apply them cleanly
Put the whole command in a start script, or on modern Forge/Fabric use user_jvm_args.txt for the flags. A simple start.sh:
#!/bin/bash
java -Xms6G -Xmx6G -XX:+UseG1GC -XX:+ParallelRefProcEnabled \
-XX:MaxGCPauseMillis=200 -XX:+AlwaysPreTouch \
-jar server.jar nogui
chmod +x start.sh && ./start.sh
(Use the full flag list above in a real script.) Combine the flags with the config changes in our lag-reduction guide for the best result, and if you're on Paper you'll get the most from them.
Flags aren't magic
The flags smooth GC stutter; they don't raise your tick rate if the CPU is the bottleneck. Fast single-thread CPU, lean plugins, and reasonable view distance do the heavy lifting. The flags are the finishing touch.
Verify the GC is behaving
After applying the flags, confirm garbage collection is actually running in small, frequent steps rather than long pauses. Add GC logging to your start command:
java -Xms6G -Xmx6G -Xlog:gc*:file=gc.log:time,uptime:filecount=5,filesize=10M \
-XX:+UseG1GC ... -jar server.jar nogui
Then watch gc.log — with the flags working you'll see many short "Pause Young" collections and few, brief mixed collections. Long "Full GC" pauses mean the heap is undersized or over-allocated. In-game, Paper's /spark and the client F3 screen also show heap behaviour.
What about ZGC or Shenandoah?
You may see people suggest newer low-pause collectors. For most Minecraft servers, G1GC with Aikar's flags remains the recommended default — it's the most tested combination and performs well across typical heap sizes. ZGC and Shenandoah can help on very large heaps (16 GB+) where their near-pauseless design shines, but they use more CPU and aren't universally better for Minecraft's allocation pattern. Unless you're running a huge modded server and have measured a benefit, stay on the standard G1 flags.
Flags in containers and on managed hosts
If your server runs in a container or a memory-limited environment, be careful that -Xmx fits inside the available memory with room for the OS and off-heap usage — the JVM uses more than just the heap. A good rule is to leave at least 1 GB free beyond -Xmx, as covered in our RAM guide. Combine the flags with the config-level tuning in our lag guide and lean plugins for the smoothest result — the flags handle GC stutter, but CPU and tick load set your actual TPS.
Putting it all in a start script
Rather than typing the long flag list each time, save it in a script so it's consistent and easy to tweak. A complete start.sh:
#!/bin/bash
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 server.jar nogui
chmod +x start.sh
./start.sh
Point your systemd ExecStart at this script, and every restart uses the exact same tuned flags. To change memory later, you edit one line. This pairs perfectly with the config tuning in our lag guide and a right-sized allocation from the RAM guide.
FAQ
Do Aikar's flags increase TPS?
Not directly. They reduce garbage-collection pauses (stutter). TPS is bound by CPU and your world's tick load.
Should Xms and Xmx be the same?
Yes — set them equal so the JVM doesn't resize the heap. With AlwaysPreTouch this gives steadier performance.
Do the flags work on modded servers?
Yes, on any Java Minecraft server. Modded servers, which allocate more objects, often benefit even more.
What Java version should I use with these flags?
Match Java to your Minecraft version (Java 17 for 1.18–1.20.4, Java 21 for 1.20.5+). The flags work across modern Java releases.
Good flags plus good hardware is the winning combo. Nxeon's Minecraft hosting runs on high-clock NVMe VPS plans where these flags shine.