← All guides

Aikar's Flags Explained: JVM Startup Flags for Minecraft

Updated November 29, 2026 · 5 min read

If you've ever looked at a Minecraft server start script and seen a wall of -XX: options, those are almost certainly Aikar's flags. They've been the standard Java settings for Minecraft servers for years, and Paper's own docs still recommend them. Here's what they do, the copy-paste version, and how to avoid the usual mistakes.

Short answer
Aikar's flags are a set of Java garbage collector settings tuned for Minecraft. Use them with -Xms and -Xmx set to the same value, a bit below your total memory. They smooth out memory cleanup pauses, which can show up as small lag spikes. They are not a fix for a CPU that can't keep up.

What the flags actually do

Java manages memory for you. Every chunk, entity and item creates objects, and a background process called the garbage collector (GC) cleans up the ones that are no longer used. If the GC runs at a bad moment, or takes too long, the server freezes for a fraction of a second. Players feel that as a short stutter.

Minecraft creates a huge number of short-lived objects every tick. Java's default GC settings aren't tuned for that pattern. Aikar's flags configure the G1 garbage collector to:

The flags (heap of 12 GB or less)

Here's the standard set. Replace 10G with your own memory amount, and server.jar with your jar's file name:

java -Xms10G -Xmx10G -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 server.jar --nogui

Put that in a start.sh (Linux and macOS) or start.bat (Windows) file in the server folder and run it to start the server.

The changes for more than 12 GB

With a bigger heap, a few values should change so the young generation and region size scale up:

Flag 12 GB or less Over 12 GB
G1NewSizePercent 30 40
G1MaxNewSizePercent 40 50
G1HeapRegionSize 8M 16M
G1ReservePercent 20 15
InitiatingHeapOccupancyPercent 15 20

Everything else stays the same. Most plugin servers never need more than 12 GB. Big modpacks are where you'll use the second column. If you're not sure how much you need, read how much RAM a Minecraft server needs.

What a few of the important ones mean

You don't need to understand every flag to use them, but these are worth knowing:

How much memory to give -Xmx

Don't set -Xmx to every last megabyte you have. Java uses some memory outside the heap for threads, loaded classes and native libraries. If the heap plus that overhead goes over the real limit, the operating system or the container kills the process, and you get a crash with no Java error at all.

A safe rule:

Many hosts set the memory flags for you from the plan size, so check your panel's startup settings before you add your own -Xmx on top. Two -Xmx values on one line is confusing, and Java just uses the last one.

Mistakes that make things worse

Giving it far too much memory. A 32 GB heap on a small Paper server doesn't help. Bigger heaps can mean longer pauses when a full cleanup does happen. Size it to what you actually use. If you're crashing from running out, see out of memory crash fixes.

Using -Xmx without -Xms. The heap starts small and grows under load, which is exactly when you don't want extra work happening.

Mixing in flags from random forum posts. Turning on a second garbage collector (for example -XX:+UseParallelGC next to -XX:+UseG1GC) stops Java from starting at all. Old options like -XX:+UseConcMarkSweepGC were removed years ago and do nothing on modern Java. Use one set and stick to it.

Old Java. Use the Java version your Minecraft version wants. Modern versions need Java 21, and the newest need Java 25. See which Java version your server needs.

On newer Java releases you might see a warning at startup that an option is ignored or deprecated. That's harmless. The server still starts, and the rest of the flags still apply.

What about ZGC?

On Java 21 and later, some admins use the ZGC garbage collector instead of G1 (-XX:+UseZGC). It can keep pauses extremely short, but it tends to use more memory and CPU, so it suits servers with plenty of spare RAM and cores. If you're on a normal plan with a few GB, G1 with Aikar's flags is the safer choice. Don't combine ZGC with the G1 flags above. Pick one.

How to tell if they're helping

Flags are about smoothness, not raw speed. The best way to check is to watch your GC behavior:

  1. Install spark (recent Paper builds include it already).
  2. Run /spark health to see memory use and recent GC activity.
  3. Run /spark gc to see how often collections happen and how long they take.

If GC pauses are short and rare, your flags are fine and any lag is coming from somewhere else. How to read a spark profiler report walks through finding the real cause, and why is my server lagging covers the usual fixes.

Related

FAQ

Should -Xms and -Xmx be the same?

Yes, for a dedicated server. Setting both to the same value lets Java claim all its memory at startup instead of growing and shrinking the heap while players are online.

Do Aikar's flags work on Forge, NeoForge and Fabric?

Yes. They're Java garbage collector settings, not Paper settings, so they work for any Java server. Modded servers often benefit the most because they create a lot of short-lived objects.

Will startup flags fix my lag?

Only if the lag comes from garbage collection pauses. Flags make memory cleanup smoother. They don't make the CPU faster or fix a mob farm with 2,000 chickens.

Want a server that just runs fast?

FreaksMC runs on NVMe hardware with performance-tuned defaults baked in - pre-optimized Paper, sane view distances, and one-click world pre-generation. Set up in 60 seconds.

See plans from $3/mo

We use cookies for analytics & ads to measure how our site performs. Essential cookies always run. See our Privacy Policy.