Free tool
Aikar's flags generator
The community-standard JVM tuning for Minecraft servers, sized to your heap.
Leave the OS ~1–2 GB: on a 8 GB server, a 6–7 GB heap is right.
java -Xms8G -Xmx8G -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
Aikar's flags are the de-facto standard startup settings for Minecraft servers, developed by the Paper project's community from real GC logs. The generator emits the current canonical set with the correct G1 sizing for your heap — including the variant that kicks in at 12 GB and above.
One honest caveat: flags are the last 10%, not a fix for an undersized server. If you're fighting lag, verify RAM and single-core CPU speed first (the RAM calculator is one tab over), then apply tuned flags for smoother pacing.
Common questions
What do Aikar's flags actually do?
They tune Java's G1 garbage collector for Minecraft's allocation pattern: lots of short-lived objects per tick. The flags size the young generation aggressively and pace collection so the GC works in small, frequent steps instead of long world-freezing pauses.
Why do the flags change at 12 GB?
Large heaps shift the trade-offs: the standard settings leave too much old-generation churn, so the 12 GB+ variant raises G1NewSizePercent to 40, uses 16M heap regions and starts concurrent collection earlier. The generator switches automatically at your heap size.
Should -Xms and -Xmx be equal?
Yes, for servers. Equal minimum and maximum heap plus AlwaysPreTouch means the memory is claimed and paged in at boot, avoiding allocation stalls later. This is the opposite of desktop-Java advice, which is why it surprises people.
Do these flags work for Forge and Fabric servers?
Yes — they're loader-agnostic JVM settings. Point the command at your loader's jar (or run file) and keep the heap honest: modded servers need the RAM first, flags second. Flags tune GC behavior; they don't create memory.
Skip the startup-script maintenance
ReFx Minecraft servers apply tuned memory flags automatically, derived from your plan size.