Aikar flags are a set of Java startup arguments that tune the G1 garbage collector for the way a Minecraft server uses memory. PaperMC publishes them as its recommended startup flags. You add them to the command that starts the server, set -Xms and -Xmx to the same value about 1–1.5 GB below the memory you have, and restart.
They work with any Java Edition server jar (Paper, Purpur, Vanilla, Fabric or Forge), because they change Java, not Minecraft. The examples use paper.jar; swap in your own jar name.
What Aikar flags do
A Minecraft server creates huge amounts of short-lived objects. PaperMC's documentation mentions allocation rates of at least 800 MB per second on a 30-player server. Java has to clean that up with garbage collection, and when it does it badly you get pauses that show up as lag spikes and TPS drops. The flags give the young generation more room (30–40% of the heap instead of the default 5%), so short-lived data dies young and the server pauses less often. If your server is already lagging for other reasons, start with our Minecraft server lag fix; flags help the garbage collector, not slow plugins or too many entities.
The full Aikar flags startup line
This is the line from the PaperMC docs, with the memory already set for an 8 GB plan (more on sizing below):
java -Xms6500M -Xmx6500M -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 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar paper.jar --nogui| Flag | What it does (per the PaperMC docs) |
|---|---|
-Xms = -Xmx | Start with the full heap. Memory below Xmx that Java never takes is wasted, and G1 works better with more of it. |
-XX:+UseG1GC | Uses the G1 garbage collector, which the rest of the flags tune. |
G1NewSizePercent=30, G1MaxNewSizePercent=40 | Gives new objects 30–40% of the heap, so young collections run less often. |
G1HeapRegionSize=8M | Bigger regions so fewer objects count as “humongous”. |
G1ReservePercent=20 | Keeps more memory in reserve to avoid “to-space exhaustion”. |
MaxGCPauseMillis=200 | A pause goal of 200 ms, at most about 4 ticks. |
MaxTenuringThreshold=1 | Stops copying transient data back and forth before it is promoted. |
+DisableExplicitGC | Ignores plugins that try to force a full garbage collection. |
+AlwaysPreTouch | Reserves the memory at start-up so it is ready to use. |
The two -D properties at the end (using.aikars.flags and aikars.new.flags) do not tune anything; they just mark the process as using this set. Keep them, they cost nothing.
How much memory to put in Xms and Xmx
This is where most people get it wrong. PaperMC says it plainly: do not allocate all of your memory. Java and Minecraft use memory on top of -Xmx, so if your plan has 8 GB and you write -Xmx8G, the process can go over the limit and get killed. The docs suggest reducing Xms and Xmx by about 1000–1500 MB.
| Plan RAM | Xms and Xmx | Notes |
|---|---|---|
| 4 GB | 2500M to 3000M | Below PaperMC's recommended range; fine for a few friends on Paper |
| 6 GB | 4500M to 5000M | Small SMP |
| 8 GB | 6500M | The example PaperMC itself gives |
| 12 GB | 10500M to 11000M | Busy survival, light modpacks |
| 16 GB | 14500M to 15000M | Large modpacks |
PaperMC recommends at least 6–10 GB no matter how few players, and also says that going up to 32 GB gives minimal returns. If you are not sure what your world needs, our guide on how much RAM a Minecraft server needs breaks it down by player count and mods.
How to use Aikar flags step by step
- Note the RAM of your plan or PC and subtract 1000–1500 MB. That number goes in both
-Xmsand-Xmx. - Copy the full line above and change the two memory values and the jar name.
- On your own PC, paste it into your start script (
start.baton Windows,start.shon Linux or macOS) in place of the oldjava …line. - On a hosted server, open the Startup tab of the panel and check the startup command and the memory field. If the command is not editable on your plan, contact support by chat or ticket and ask for Aikar flags with your memory value.
- Restart the server from the Console tab and watch the start-up: if Java prints “Unrecognized VM option” or “Could not create the Java Virtual Machine”, a flag was mistyped.
- Optional: add the GC logging flag below, play for a while and read
logs/gc.logto see how long the pauses are.
-Xlog:gc*:logs/gc.log:time,uptime:filecount=5,filesize=1MPaperMC notes that GC logging does not hurt performance and the files stay around 5 MB, so you can leave it on.
Common mistakes
- Two memory settings at once. If your start script or panel already passes
-Xmxsomewhere else, the last one on the line wins. Keep a single pair. - Xmx equal to the plan. The out-of-memory kill described above. If the server stops with no error in the log, check this first. Our page on a server not using its allocated RAM covers the opposite problem.
- Flags after
-jar. Anything after-jar paper.jargoes to Minecraft, not Java. JVM flags must come before it. - Adding random extra flags. Transparent huge pages (
-XX:+UseTransparentHugePages) are marked “controversial” by PaperMC and only make sense withAlwaysPreTouchon a system configured for them. Do not copy flag lists from videos without knowing what they change.
Run Aikar flags on hardware that keeps up
Flags help the garbage collector, but the CPU still decides how fast each tick runs. A TheGameHosting Minecraft server runs on AMD Ryzen 9950X and 7950X3D CPUs up to 5.7 GHz with DDR5 and NVMe, and you pick the RAM: 8 GB is $6.96 USD/month and 12 GB is $9.99. The Startup tab shows how the server launches, the Version tab switches between Paper, Purpur, Fabric and more, and 24/7 chat support can help you with the startup line. Compare the plans and pricing and use FULL2026 for 15% off for life.
FAQ
Do Aikar flags still work with modern Java and Minecraft 26.x?
They are still the startup flags PaperMC documents. They are HotSpot options for the G1 collector. If a newer Java release stops supporting one, Java prints a warning or an error at start-up, so read the first lines of the console after you add them.
Are Aikar flags only for Paper?
No. They tune Java, so they work with Vanilla, Purpur, Fabric and Forge too. Only the jar name at the end changes.
Should Xms be the same as Xmx?
Yes, that is what PaperMC recommends: the server should be expected to use the whole Xmx, so starting lower only leaves memory unused.
Will Aikar flags fix my lag?
Only lag caused by garbage collection pauses. Low TPS from too many entities, heavy plugins or chunk generation needs other fixes, like pre-generating the world.
Hosting for these games
Written by TheGameHosting Team, the people who run our servers in Dallas and Amsterdam and answer your tickets.
All posts
TheGameHosting Team
