Learn · guides
How to Add JVM Arguments to Minecraft
Add JVM arguments to Minecraft by editing your launcher's profile settings. Step by step for the official launcher, plus the essential -Xmx flag.
JVM arguments configure the Java virtual machine that runs Minecraft before the game even loads. They live in your launcher's profile settings and control things like memory allocation, garbage collection, and Java behavior. Add them wrong and your game won't start; add them right and you can smooth out stutters and crashes.
What a JVM argument is
The Java Virtual Machine runs Minecraft, and JVM arguments are flags you pass to it at startup. When you press Play, your launcher builds a command line that includes these flags. The JVM reads them before starting the game, so they affect the runtime environment, not the game itself.
This is why setting them wrong breaks startup instead of breaking your world. The JVM rejects invalid flags and refuses to start, which is actually safer than a bad in-game setting.
Where to find JVM arguments in your launcher
Official Minecraft Launcher
Open Installations
Click the Installations tab at the top.
Hover your profile
Find the profile you use to play and hover over it. An edit (pencil) icon appears.
Click edit
Click the pencil icon to edit that profile.
Open More Options
Scroll to the bottom and click More Options. A JVM Arguments field appears.
Edit the flags
Click in the box and edit the space-separated list of arguments.
Save and test
Click Save, then launch the profile to confirm it works.
Third-Party Launchers
Most launchers place JVM arguments in the profile or instance settings, often under a "Java" or "Advanced" tab. The exact location varies, but they're always in profile settings, never in-game.
The argument you actually want: -Xmx
The most commonly needed flag is -Xmx, which sets the maximum heap the game can use.
-Xmx4G
This allocates up to 4 gigabytes to Minecraft. Common values:
| Flag | What it does |
|---|---|
-Xmx2G | 2 GB (minimum for modded play) |
-Xmx4G | 4 GB (recommended default) |
-Xmx6G | 6 GB (for heavy modpacks) |
-Xmx8G | 8 GB (rarely helpful beyond this) |
Don't give Minecraft more than half your system RAM. If you have 16 GB total, cap Minecraft at 8 GB. The rest keeps your OS and other programs responsive.
A safe starting line
Most launchers come with sensible defaults. If you're not sure, use this:
-Xmx4G -Xms2G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200
Breaking it down:
-Xmx4G— maximum 4 GB-Xms2G— start with 2 GB (faster startup)-XX:+UseG1GC— garbage collector that reduces stutters-XX:+ParallelRefProcEnabled— helps the collector run faster-XX:MaxGCPauseMillis=200— limits pause duration
This is a good default for modded Minecraft without heavy overclocking.
Don't replace the defaults
Launchers ship with a few default JVM arguments. Don't delete them—edit the list by adding to it. Removing the defaults can break startup.
For example, if the default is:
-Xmx2G -XX:+UnlockExperimentalVMOptions -XX:G1NewCollectionPauseTarget=45
And you want 4 GB, change it to:
-Xmx4G -XX:+UnlockExperimentalVMOptions -XX:G1NewCollectionPauseTarget=45
Just update the -Xmx value and keep the rest.
Common problems and fixes
- Game won't start: check for typos in the flags (spacing matters). Remove custom arguments and confirm the default
-Xmxline works. - Game crashes after a few minutes: you may have allocated too much (garbage collection pauses get worse). Try reducing to 4 GB.
- Game allocates less than you set: your system doesn't have enough free RAM. Close other programs or allocate less.
- Arguments have no effect: confirm you edited the right profile and saved. The launcher sometimes requires a restart to pick up changes.
Do mods need special arguments?
Usually no. Mods run inside the same Java process and share your heap. Only very rarely does a mod come with documentation specifying a JVM argument, and the author will make that clear. For 99% of cases, the same arguments work for vanilla and modded play.
FAQ
It sets the maximum heap memory available to Java. -Xmx4G means Minecraft can use up to 4 gigabytes. This is what "allocate more RAM" means.
4 to 6 gigabytes is the safe range for most players. Allocating far more rarely helps and can actually increase stutter because garbage collection takes longer on a large heap.
Usually no. Mods run inside the same Java process and share your memory allocation. Only rarely will a mod's documentation specify a JVM argument, and the author will make it obvious.
No. JVM arguments configure the Java runtime before the game starts. Game settings are in-game options. They're completely separate things.