Java Flags Generator
Generate optimized JVM flags based on Aikar's flags for better Minecraft server performance.
Server Configuration
Select the RAM you want to allocate to Minecraft (leave 1-2GB for the OS)
Notes
- •These flags are based on Aikar's optimized flags for Minecraft servers.
Start Command
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 -XX:+UseStringDeduplication --add-modules=jdk.incubator.vector -jar paper.jar noguiCopy this command and use it in your start.bat (Windows) or start.sh (Linux) file.
Flag Explanations (22 flags)
Memory
-Xms=8GInitial heap size - set equal to max for consistency
-Xmx=8GMaximum heap size - main RAM allocation
-XX:+UseStringDeduplicationDeduplicate identical strings - saves memory
Garbage Collection
-XX:+UseG1GCUse G1 garbage collector - best for Minecraft
-XX:+ParallelRefProcEnabledProcess references in parallel - reduces GC pauses
-XX:MaxGCPauseMillis=200Target max GC pause time in milliseconds
-XX:+UnlockExperimentalVMOptionsEnable experimental JVM options
-XX:+DisableExplicitGCDisable System.gc() calls - prevents plugins from forcing GC
-XX:G1NewSizePercent=30New generation size - balanced for moderate RAM
-XX:G1MaxNewSizePercent=40Max new generation size
-XX:G1HeapRegionSize=8MHeap region size - standard for under 12GB
-XX:G1ReservePercent=20Reserve memory percentage
-XX:G1HeapWastePercent=5Acceptable heap waste percentage
-XX:G1MixedGCCountTarget=4Target mixed GC count
-XX:InitiatingHeapOccupancyPercent=15Start GC when heap is 15% full - aggressive but reduces lag spikes
-XX:G1MixedGCLiveThresholdPercent=90Mixed GC live threshold
-XX:G1RSetUpdatingPauseTimePercent=5Time spent updating remembered sets during pause
-XX:SurvivorRatio=32Ratio of eden to survivor space
-XX:MaxTenuringThreshold=1Objects survive 1 minor GC before tenuring - faster promotion
Performance
-XX:+AlwaysPreTouchPre-allocate memory pages at startup
-XX:+PerfDisableSharedMemDisable shared memory for performance counters
--add-modules=jdk.incubator.vectorEnable vector API for SIMD optimizations (Java 16+)
About These Flags
These flags are based on Aikar's optimized flags, which are widely recognized as the best JVM configuration for Minecraft servers. They focus on optimizing the G1 garbage collector to reduce lag spikes and improve overall performance.
Memory Management
Setting -Xms equal to -Xmx prevents heap resizing, which can cause lag spikes. Pre-touching memory ensures it's immediately available.
G1GC Optimization
G1 garbage collector is tuned for Minecraft's memory patterns. Aggressive settings minimize pause times during gameplay.
RAM-Specific Tuning
Servers with 12GB+ RAM get different settings optimized for larger heaps, including larger region sizes and adjusted generation percentages.
Frequently Asked Questions
What are Aikar's flags?
Aikar's flags are a set of optimized JVM parameters created by Aikar (developer of Paper and other Minecraft software) that significantly improve Minecraft server performance by tuning the G1 garbage collector specifically for Minecraft's memory usage patterns.
How much RAM should I allocate?
For vanilla servers, 4-6GB is usually sufficient. For modded servers (Forge/Fabric), 6-12GB depending on mod count. Paper/Spigot servers benefit from 4-8GB for most use cases. Always leave 1-2GB for the operating system.
Which Java version should I use?
Java 17 or 21 (LTS versions) are recommended for Minecraft 1.17+. Older versions (1.16 and below) require Java 8 or 11. Always use the latest LTS release for best performance and security.
Why set -Xms equal to -Xmx?
Setting minimum and maximum heap size to the same value prevents the JVM from dynamically resizing the heap during runtime, which can cause noticeable lag spikes when the server needs more memory.
Do these flags work with all server types?
Yes, these flags work with Paper, Spigot, Purpur, Fabric, Forge, and vanilla servers. The core optimizations apply to all Minecraft server implementations since they target the JVM, not the server software itself.
Skip the complexity - VibeForge handles all optimization
Let VibeForge configure and optimize your server automatically
Have feedback or questions?
Join our Discord community to share ideas, get help, and connect with other creators.