Shaders can be very demanding, especially as the performance of Minecraft seems to get worse and worse with each new version. This page will offer some tips on how to speed up the game, so you can either enjoy a boost to your FPS or crank those shader settings even more!
If you're an Optifine user dissatisfied with the performance of the game, you should consider using Iris instead. This is a new shader loading mod for Fabric that leverages Sodium to optimize the base game as well as its own optimizations to the Optifine shader pipeline for significantly improved performance. However, it has some drawbacks, mainly due to its young age. If a shaderpack or a feature that you really want is not supported, Iris may not be right for you.
Using Iris but missing some of Optifine's other features, like CTM? Check the FAQ channel on the Iris discord server for alternative Fabric mods.
Some of the tweaks on this page will not apply to Iris.
Shader Selection Menu
On the right hand side of your shader selection menu, you will see several options.
This should generally never be raised above 1x. When raised, it renders the game at a higher resolution internally - 2x on a 1080p monitor will effectively be running at 4k, for example, which causes a huge performance loss. It may, however, be desirable to lower this under 1x for increased performance, but worse visual quality as the game will be running at a lower resolution. In very rare cases changing this can break some shaderpacks, so be careful with it.
There is essentially no reason to change this to a setting other than 1x. Like render quality, increasing it incurs a performance loss, and lowering it improves performance. However, it is a better idea to change this setting in the shader options of each individual shader, which will have less potential to cause bugs. It will usually be called something like "shadowmap resolution". In shaders which don't provide such an option, such as PTGI, they may require an exact resolution and break completely if you change the shadow quality setting.
Enabling this causes a small performance loss, and most shaders will implement a form of TAA, which is a superior method of antialiasing to the FXAA which Optifine implements for this option. In the few shaders which don't use their own antialiasing, enabling this may be desirable.
Video Settings -> Performance
This tab provides several performance enhancing options, many of which are not enabled by default due to mod compatibility concerns. If you're using these with a modpack and notice strange rendering issues, you should try turning them off (especially Fast Render, which is the culprit for quite a few issues).
Render Regions, Fast Render, Smart Animations, and Lazy Chunk Loading should all be turned on if possible for best performance. Fast Math can be turned on as well, but be aware that you may notice (very small) changes in the way the world generates. Raising Chunk Updates/turning on Dynamic Updates will reduce performance but load new chunks faster. Smooth FPS should never be turned on, the way it makes FPS smooth is by limiting it.
You may have heard that AF is a way to boost image quality at near-zero performance loss. This is generally true, but Minecraft in particular is a game that's not designed for AF, so in order to get it into a state where AF can even be enabled, several optimizations have to be disabled. This is why you will see a large performance loss going from off to 2x, and almost nothing going from 2x to 16x. Therefore, this option should be left off in most cases.
Render Distance, Simulation Distance, and Entity Distance
Raising these lowers your performance exponentially. Currently, it is recommended to stay under 16 chunks to maintain reasonable performance with shaders. However, with the planned decoupling of ticking logic into the Simulation Distance setting in 1.18, it may become possible to keep Simulation Distance low while raising Render Distance high and keeping good performance, since chunks outside Simulation Distance are visibly loaded but not constantly being updated.
Having to handle large amounts of entities is a common reason why people experience lag in specific areas of their worlds. While Entity Distance can help with this, it's also important to manage how many entities you use. If you have, for instance, a large storage system with every chest marked with an item frame, this is going to have a huge impact on performance.
This option is surprisingly performance heavy. This is because vanilla Minecraft implements it in a naive way - for instance, if you have it set to the maximum 15x15, Minecraft will perform 15x15=225 blend checks around every block. Therefore, in vanilla this should be kept low. However, a better algorithm exists, which allows you to use the maximum setting with minimal performance loss - it's implemented in Iris using Sodium, and is also implemented as a standalone mod for Optifine users. See the Mods section.
It's a common misconception that allocating more RAM speeds up your game. However, with the default garbage collection Minecraft uses, the time between collection cycles will be longer (because there's more RAM to fill) but the collection itself will also take longer (because there's more RAM to clear) if you allocate too much RAM. This results in noticeable lag spikes. The general rule of thumb is to keep your used RAM between 50 and 75% - you can check this on the second line of the right hand side of the F3 menu. As your RAM fills and clears, you may find it impossible to stay in this range all the time. That's alright, this is not a strict rule. As long as you're in the range most of the time, and not seeing numbers like 20% or 95%, you have a good amount allocated.
Fabric is undergoing a bit of a renaissance in performance mods. Some of the mods in this list will have Forge ports, but this page will not cover them. Many of these mods will also require Fabric API, and if you're an Optifine user you will need Optifabric. See the Fabric wiki for help with installation.
Starlight completely rewrites Minecraft's lighting engine for a huge performance improvement.
Lithium optimizes many of the game's server-side calculations, such as redstone. Iris only.
LazyDFU optimizes the DFU - the process that allows old worlds to be updated to new versions.
Better Biome Blend optimizes the Biome Blend setting - see above for an explanation on why this is slow in vanilla Minecraft.
Enhanced Block Entities optimizes some block entities, also known as tile entities.
Entity Distance expands the titular setting to be adjustible per entity.
Recipe Cache optimizes the crafting table and furnace.
Laptops with dedicated GPUs
These laptops have systems to switch between the dedicated and integrated GPUs depending on which application is currently running, for performance and battery life respectively. Often, Minecraft will not be properly detected by these systems as a program which requires high performance.
If you think you have one of these laptops but you're not sure, open Task Manager and head to the Performance tab. If you don't see a Performance tab, click "more details". If your laptop has two kinds of GPU, they will be listed as GPU 0 and GPU 1 in this tab. Typically 0 will be the integrated graphics and 1 will be the dedicated graphics. If you only see GPU 0, you do not have one of these laptops.
If you have one of these laptops and you're not sure what GPU Minecraft is using, you can check by looking at your F3 debug overlay - it will be displayed on the right hand side right under the display resolution.
If Minecraft is using the wrong GPU: first, open Task Manager while the game is running. You will see a process for Java (not Minecraft!) - right click it and select "open file location". A File Explorer window will open, click the address bar and copy the contents to your clipboard.
Then, open the Windows graphics settings. Click browse, and paste the file path you just copied. Scroll until you see "javaw", select that, and click "Add". Click "options", "High performance", and save. Relaunch the game, and verify that the correct GPU is now displayed in the F3 menu.