Lethium

Startup flags

Minecraft Server Startup Flags Generator

Aikar's flags, Velocity's flags or ZGC, written as start.sh, start.bat, a Pterodactyl startup line or Docker settings. Every flag is explained, with its source.

Tools / Startup Flags Generator

Server

Memory

Container and panel memory helper

Java uses more memory than -Xmx. On top of the heap come class data (metaspace), a stack per thread, the garbage collector's own tables, compiled code and network buffers: usually 0.5 to 1.5 GB more, and more with ZGC. If the total passes your host's limit, the kernel kills the server without a crash report.

Where it runs

Garbage collector

Aikar's values for heaps over 12 GB

Options

Your start script

What each flag does

    Check an existing start command

    Paste a start.sh, start.bat, panel startup line or plain java command. The checker finds the memory, the collector and the server, and points out flags that newer Java refuses or ignores.

    How to make a Minecraft server start script

    1. Pick your server software and Minecraft version. The page tells you which Java version it needs.
    2. Set the heap with the slider. If your server runs in a panel, a container or on a small VPS, enter the memory limit in the helper and use the value it suggests.
    3. Keep G1 with Aikar's flags unless you have a reason to change. Proxies get the flags their own docs recommend.
    4. Choose start.sh for Linux, start.bat for Windows, or the Pterodactyl or Docker tab. Copy it or download it next to your server jar.
    5. Open What each flag does if you want to know why a flag is there. Every line links to where it comes from.

    On Linux, make the script runnable once with chmod +x start.sh, then start it with ./start.sh. Run it inside screen or tmux so the server keeps running after you log out. On Windows, double-click start.bat.

    Aikar's flags explained

    Aikar's flags tune Java's G1 garbage collector for the way a Minecraft server uses memory. The game creates hundreds of megabytes of short-lived objects every second, mostly small things like block positions. The flags give G1 a much larger young generation (30 to 40% of the heap instead of 5%), so these objects die before they are copied around, and they keep pauses near 200 ms or below. PaperMC publishes the flags and explains each one in its docs.

    For heaps over 12 GB, Aikar's post gives larger values: G1NewSizePercent=40, G1MaxNewSizePercent=50, G1HeapRegionSize=16M, G1ReservePercent=15 and InitiatingHeapOccupancyPercent=20. PaperMC's docs listed them too until a clean-up in February 2024, and now show one set for every size. The generator switches to the larger values above 12 GB; you can turn that off. If you see more old generation collections after the switch, go back to the standard values.

    Proxies are different. Velocity's docs give their own short G1 set with -XX:MaxInlineLevel=15, and Waterfall's docs list a set for Waterfall and BungeeCord. For Fabric, Forge and NeoForge there is no separate set: Aikar's flags tune the Minecraft server itself, so they apply there as well.

    PaperMC's own script generator adds one more piece of advice: on a modern Java version, try the default settings first, and use Aikar's flags if you see GC problems. The Java default option writes a script with only the memory flags.

    How much RAM a Minecraft server needs, and the panel limit

    PaperMC recommends 6 to 10 GB of heap for a server, however few players it has, and says more than that soon stops helping. The heap is only part of it. Java also needs memory for class data, threads, the garbage collector and network buffers, and the operating system needs some too. PaperMC's advice: if the host gives you 8 GB, set -Xmx to about 6500 MB.

    In a panel or container this matters more, because the limit is hard. Pterodactyl's Wings adds 5 to 15% on top of the memory you see in the panel as a safety margin, but a heap set to the full panel value still leaves Java too little room. Velocity's docs go further for proxies in containers: give the heap half of the container. The helper uses these numbers as a rule of thumb, not an exact measurement.

    With -XX:+AlwaysPreTouch and the same -Xms and -Xmx, the whole heap is in use from the first second. That is expected, and it means a too-large heap shows up straight away instead of hours later.

    ZGC for Minecraft: when it helps

    Generational ZGC arrived in Java 21 (JEP 439) and became the only ZGC mode later: Java 23 made it the default (JEP 474) and Java 24 removed the old mode (JEP 490). On Java 21 and 22 you need -XX:+UseZGC -XX:+ZGenerational; from Java 23 on, -XX:+UseZGC alone. The generator writes the right form for the Java you pick.

    ZGC does most of its work while the server keeps running, so pauses stay very short even with a large heap. The price: it needs free room inside the heap to keep up, and its threads take CPU time next to the server. Oracle's guide calls the heap size the most important ZGC setting. Give ZGC a bigger heap than you would give G1, and a bigger container to match. It suits big servers with many cores. On a small host with few cores, G1 with Aikar's flags is the safer choice.

    Questions

    What are Aikar's flags?

    A set of JVM flags that tune the G1 garbage collector for a Minecraft server. Minecraft creates a huge number of short-lived objects, so the flags give G1 a much bigger young generation and shorter pauses. PaperMC publishes them in its docs, and they work for any Minecraft server, including Fabric and Forge.

    How much RAM should I give my Minecraft server?

    PaperMC recommends at least 6 to 10 GB for the heap, and says that much more than that brings little. Java also needs memory outside the heap, so on a host with 8 GB, PaperMC suggests about 6500 MB for -Xmx. The memory helper on this page works out a safe value for your limit.

    Why should -Xms and -Xmx be the same?

    Your server should be able to use the whole -Xmx anyway, so memory below it that stays unused is wasted. With G1, more heap means objects have more time to die young. PaperMC's docs recommend the same value for both.

    Should I use ZGC for my Minecraft server?

    It is an option, not an upgrade. Generational ZGC (Java 21 and newer) keeps pauses very short, but it needs more spare room in the heap and runs its threads next to the server. It suits big heaps on machines with many cores. If your server runs well on G1 with Aikar's flags, there is no need to switch.

    Why does my server get killed when -Xmx is below the panel limit?

    Java uses more memory than -Xmx: class data, threads, the garbage collector's own data and network buffers come on top. When the total passes the container limit, the kernel stops the process. Leave 15% of the limit, or at least 1 to 1.5 GB, outside the heap.

    What does --add-modules=jdk.incubator.vector do?

    It loads Java's incubating vector module. Pufferfish uses it for faster map rendering and a few other operations, and some older Purpur builds that contained Pufferfish's code did too. Paper and current Purpur do not use it.

    Is my start command sent anywhere?

    No. The generator and the checker run in your browser. Your settings are saved in this browser and in the page address, so the Share link button can pass them on.