Back to Blog
guides 9 min read By CraftRift Admin

Aikar's Flags Explained: Optimized JVM Flags for Minecraft Servers (2026)

Aikar's flags explained for 2026: the full copy-paste G1GC JVM args for Paper, a variant for 12GB+ RAM, and the mistakes that undo them.

Last updated: August 19, 2026

minecraft aikar-flags jvm g1gc performance paper optimization
On this page

If your Minecraft server runs fine for a few minutes and then freezes for half a second, garbage collection is usually the culprit. Aikar’s flags are the standard fix, and they have been the community default for years because they work. This guide gives you the current flag string, explains the parts that matter, and covers the mistakes that quietly cancel out the benefit.

Quick answer: Aikar’s flags are a tuned set of G1GC garbage collector arguments that stop Minecraft’s roughly 800MB per second allocation rate from causing lag spikes. Paste the standard flag string, set Xms equal to Xmx, and leave 1000 to 1500MB of system RAM unallocated. Servers above 12GB use a slightly larger young-generation variant.


What Are Aikar’s Flags?

Aikar’s flags are a set of Java Virtual Machine startup arguments that tune the G1 garbage collector for Minecraft server workloads. Created by the Paper contributor Aikar and documented in Paper’s official docs, they replace the JVM’s generic defaults with values matched to how Minecraft actually allocates memory, cutting the long collection pauses players experience as sudden lag spikes.

It helps to know what they are not. They do not add throughput, fix a slow plugin, or add CPU cores. They make GC pauses shorter and more predictable, a narrow job that happens to cause a large share of the stutter people call “random lag.” Being JVM arguments, they live in your startup command, not server.properties.


Why G1GC Tuning Matters for Minecraft

Minecraft allocates memory at roughly 800MB per second, a rate Paper’s documentation calls out explicitly, and the JVM’s default G1GC settings are not built for that. Default settings let the young generation stay small, so collections run constantly, and when a large collection finally lands the whole server thread freezes and TPS drops.

The JVM splits the heap into a young generation for new objects and an old generation for survivors. Minecraft creates a huge volume of extremely short-lived objects: entity positions, packet buffers, block state lookups, pathfinding nodes. With default sizing the young generation is too small to absorb that churn, so objects get promoted simply because there was no room. The old generation fills with garbage, cleaning it needs a long pause, and a long pause on the main thread rubber-bands every player at once.

Aikar’s flags enlarge the young generation so garbage dies where collection is cheap, and block early promotion. Pauses become more frequent but far shorter, which nobody notices.


The Standard Aikar’s Flags (Copy and Paste)

Use the flag string below exactly as written, changing only the Xms and Xmx values to match your allocation. This is the version published in Paper’s official documentation as of August 2026, and it tunes the JVM rather than the server software, so the same string applies to Paper, Purpur, Spigot, or a plain vanilla jar.

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 paper.jar --nogui

Change two things before using it: -Xms10G -Xmx10G becomes your actual allocation with both values identical, and paper.jar becomes your real jar filename. The two -D properties at the end are markers rather than tuning, telling Paper’s timings reports that the JVM is running Aikar’s flags.

Paper’s docs recommend at least 6 to 10GB regardless of player count, because G1GC has more room to work with a larger heap. If you are unsure what fits your setup, our Minecraft server RAM guide breaks it down by workload and mod count.


The 12GB+ RAM Variant

If you allocate more than 12GB, Aikar publishes five adjusted values that give the young generation more room and reduce region churn on a large heap. Everything else in the string stays identical. Swap in the values below, then watch your GC behavior: if old generation collections increase after the change, revert to the standard flags.

-XX:G1NewSizePercent=40
-XX:G1MaxNewSizePercent=50
-XX:G1HeapRegionSize=16M
-XX:G1ReservePercent=15
-XX:InitiatingHeapOccupancyPercent=20

The standard 30/40 sizing is deliberately conservative to avoid to-space exhaustion on smaller heaps; past 12GB that risk shrinks, so more of the heap can go to the young generation. The larger 16M region size means fewer regions to track and fewer humongous allocations. Do not apply this variant to an 8GB server hoping for a head start.


What the Key Flags Actually Do

You do not need to understand every flag, but a handful do most of the work and explain why the set is shaped the way it is. The rest are supporting values that keep pause targets and heap reserves consistent. Here is what the important ones control and why Aikar picked those numbers.

FlagWhat it does
-Xms = -XmxLocks the heap to a fixed size so the JVM never grows or shrinks it, and G1 can plan against a known budget
-XX:+UseG1GCSelects the G1 collector, which collects in regions and targets a pause time instead of stopping the world for the whole heap
-XX:MaxGCPauseMillis=200Aims for pauses under 200ms. Lower is not automatically better; too low forces G1 to collect constantly
-XX:G1NewSizePercent=30Guarantees the young generation at least 30 percent of the heap, the single biggest change versus JVM defaults
-XX:MaxTenuringThreshold=1Stops transient data from being copied repeatedly before promotion, so it never reaches the old generation
-XX:+AlwaysPreTouchTouches every heap page at startup so the OS commits memory up front. Slower startup, smoother runtime
-XX:G1HeapRegionSize=8MKeeps regions large enough that normal allocations are not treated as expensive humongous objects
-XX:+DisableExplicitGCIgnores System.gc() calls from badly behaved plugins, which would force a full stop-the-world collection

That last flag earns its place: one plugin calling System.gc() on a timer produces exactly the periodic freeze people blame on their host. For the tuning layers above the JVM, see our guide on holding 20 TPS with 50 players.


How to Apply Them in a Start Script or Pterodactyl Panel

On a start script, paste the flags between the java command and the -jar argument; on Pterodactyl, put them in the Startup tab rather than editing a script file. Panels usually expose memory separately, so set the panel’s memory limit first, then size Xms and Xmx to sit below it.

On a self-managed start script

Edit start.sh (or start.bat on Windows) and keep the whole flag string on a single line:

#!/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 paper.jar --nogui

Every JVM flag must come before -jar. Anything after the jar name is passed to Minecraft instead of the JVM, so a flag that drifts past it is silently ignored.

On Pterodactyl

Open your server, go to the Startup tab, and find the Java arguments field. Paste everything from -XX:+UseG1GC through -XX:MaxTenuringThreshold=1, leaving -Xms, -Xmx, and the jar name to the panel, which sets them from your plan’s memory limit. Restart and check the console: the JVM prints an Unrecognized VM option warning for anything it rejected.

While you are in the panel, our free config generator produces matched server.properties and Paper values so your JVM and server tuning agree. An interactive Aikar’s flags generator is coming to our tools section shortly, building the correct string and the 12GB+ variant from your allocation.

Prefer not to hand-tune a startup command at all? Our Minecraft hosting plans ship with tuned JVM flags applied by default on low-ping SEA nodes, from $3/month.


Common Mistakes That Undo Aikar’s Flags

The three mistakes that undo Aikar’s flags are setting Xms lower than Xmx, allocating every gigabyte the machine has, and copying a flag string without updating the memory values. Each one either defeats the tuning outright or pushes the host into swapping, which costs far more performance than the flags recover.

Xms and Xmx set to different values

Inherited from old tutorials recommending -Xms1G -Xmx6G to “save memory.” It saves nothing. The JVM grows the heap under pressure anyway, and while it grows, G1 is planning against a moving target. Paper’s docs are explicit that keeping the two equal lets G1 optimize properly.

Allocating all available system RAM

The OS and the JVM’s own non-heap memory both need room. Paper’s documentation recommends reducing your allocation by about 1000 to 1500MB below what is available, with a concrete example: on an 8GB system, allocate 6.5GB. Exceed that and the OS swaps heap pages to disk, producing freezes far worse than any GC pause.

Pasting the flags without editing them

The published string uses -Xms10G -Xmx10G as an example, not a recommendation. Pasting it unchanged onto a 4GB plan asks the container for memory it does not have, and the server either refuses to start or gets killed mid-session by the out-of-memory handler.

Assuming more RAM equals more performance

Paper’s docs note that more memory does not mean better performance above a certain point. A 32GB heap on a workload needing 6GB gives G1 a much larger area to scan during mixed collections, so pauses get longer, not shorter.


When You Do Not Need Aikar’s Flags

Skip Aikar’s flags when your host already applies them, when your lag comes from CPU or network rather than garbage collection, or when you run a tiny private world where GC pauses never show up. Adding flags on top of a panel that injects its own can also produce duplicate or conflicting arguments.

Check your host first. Many managed hosts apply tuned flags automatically, and layering your own on top specifies the same option twice; the JVM honors the last occurrence, so you may not get the value you configured.

For a two-player world on 2GB with no plugins, the heap never churns hard enough for GC to be the bottleneck. Diagnose before tuning: if the lag is ping-shaped rather than TPS-shaped, no JVM flag will move it.


Frequently Asked Questions

What are Aikar’s flags?

Aikar’s flags are a set of JVM startup arguments that configure the G1 garbage collector for Minecraft’s memory allocation pattern. They enlarge the young generation, stop early promotion to the old generation, and target short pause times, which reduces the periodic freezes players experience as lag spikes. Paper documents them as the recommended baseline.

Do Aikar’s flags still work on Java 21 and Java 25?

Yes. G1GC and every option in the standard string are still supported on current Java releases, and Paper’s docs publish the same flag set as of August 2026. Newer Minecraft versions raise the minimum Java requirement, but the flags themselves are unchanged. If an option is ever rejected, the console prints an unrecognized-option warning at startup.

Should Xms and Xmx be the same value?

Yes, always. Paper’s documentation states that keeping them equal prevents wasted memory and lets G1 optimize more effectively, because the collector can plan against a fixed heap instead of one that grows under load. The old advice to set a low Xms and a high Xmx predates G1GC and actively hurts performance today.

Do Aikar’s flags work on Fabric and Forge servers?

Yes. The flags configure the Java Virtual Machine rather than the server software, so they apply to any Minecraft Java server jar including Fabric, Forge, NeoForge, Spigot, and vanilla. Modded servers often benefit more than plugin servers, since heavy modpacks allocate aggressively. Just point the -jar argument at your actual launcher jar.

How much RAM should I allocate when using Aikar’s flags?

Paper’s docs suggest at least 6 to 10GB where possible, since G1GC works better with a larger heap, while warning against allocating everything the machine has. Leave roughly 1000 to 1500MB free for the operating system and JVM overhead. On an 8GB system, Paper’s own example allocates 6.5GB rather than the full amount.


Final Thoughts

Aikar’s flags are one of the rare Minecraft optimizations that really are copy-and-paste: the values are published and applying them takes two minutes. Get Xms and Xmx equal, leave headroom for the operating system, and reach for the 12GB+ variant only if you actually cross 12GB.

If you would rather skip startup command editing entirely, CraftRift runs tuned JVM flags out of the box on low-ping SEA nodes with a Pterodactyl panel and one-click jar switching. Have a look at our Minecraft hosting plans, from $3/month.

Written by

CraftRift Admin

Founder of CraftRift

CraftRift Admin is a gamer based in Southeast Asia and the founder of CraftRift, writing about Minecraft server performance, hosting, and low-latency infrastructure for players across the region.

Need Low-Ping Hosting?

CraftRift runs on low-ping SEA nodes. Fast ping across Southeast Asia, starting at $3/mo.