How to Optimize Unity's Build Size
How to Optimize Unity's Empty WebGL Build Size from 10MB to 2.2MB.
Unity is a powerful game engine, but when it comes to WebGL builds, it has a reputation for bloated file sizes - even for an empty scene. A default empty project can easily exceed 10MB, which is a deal-breaker for web platforms like FB Instant Games or MSN where load times and size limits are critical to success.
But here's the good news: with smart configuration and deep understanding of how Unity compiles and packages WebGL builds, you can bring that size down to just 2MB, without sacrificing stability or core functionality.
This guide dives into exactly how to strip Unity to its barebones, eliminate unnecessary engine modules, trim code, compress assets, and configure the build pipeline to get a minimal WebGL export. We'll cover:
🚫 Disabling unused engine features and modules
🧹 Removing code stripping blockers and ensuring safe managed stripping
🛠Fine-tuning PlayerSettings, and IL2CPP settings
🧬 Using correct compression format for Builds / Images / Sounds, etc
🗜 Setting up an efficient template and build structure
Whether you're building a hyper-casual web game or trying to squeeze your prototype onto a 5MB cap platform, these techniques will help you shrink Unity to its lightest form possible.
In this Guide we will take an empty unity project and will disable components step by step, change compression settings, change quality, shadows, etc and will show you step by step how it's affected Unity build size. Please note that we will do it on empty Unity project, to make the experiment more isolated.
Switch platform to WebGL and do a build
We are doing this to understand initial build size of Unity WebGL projects with default settings.

We can see that initial build is around 9.7MB (which is quiet too much for WebGL). In this example we haven't changed anything yet, obviously if we change compression and other settings we can shrink build size (that's what we will do in the next steps).
Texture compression ASTC / DXT / ETC2
In our case, there will be no difference, because we don't use textures in current build, but depending on the platforms you can choose what suits for you. Generally we always recommend to turn on crunch compression on textures. We will not do new build here, because it will not change anything.
Strip engine code
Managed Striping Level: High (for this settings please be cautious, because sometimes it can "strip" needed code for your game, please test after enabling this checkbox).
Also enable texture mipmap stripping.

Yeeeey! We are almost there, now we have 4.6MB build, 2 more MBs and we finish our optimization journey.
Let's remove unneeded packages from the Project
Remove unneeded quality settings.

Remove Graphic Settings and set to low (for example if you use "shadows" it will be better to fully disable built-in shaders and create custom "blob" shadow system).

For example New Input System - is actually around 2.4MB, so if you don't use it, please remove New Input System Package, like in screenshot below, and finally we will get 2.2MB Unity WebGL build. We recommend using the Old Input System, as 2.4MB is quite a lot for web projects.


Some Tools that will help you optimize your WebGL game:
Build Report Inspector official Unity package, which helps to understand what’s uses more memory in your game
Asset Hunter Pro (paid)
Last updated







