Gzip or Brotli for your Unity WebGL game? A practical comparison

Gzip or Brotli for a Unity WebGL build? Real numbers for size and build time, the server headers you need, and a simple decision table.

By Tim UhlottFounder|Last updated: November 7, 2026|9 minutes read
unitycomparisoncompression
Gzip or Brotli for your Unity WebGL game? A practical comparison
Every Unity WebGL release build is compressed. The only question is with what. In Project Settings under Player, Publishing Settings, you get three options for Compression Format: gzip (what gzip is), Brotli (what Brotli is), or Disabled. The short answer is: use Brotli for the build you publish, use gzip or Disabled while you iterate, and make sure your server sends the right headers either way. The rest of this article explains why, with numbers.

Why compression matters so much for WebGL

A native game is installed once. A web game is downloaded every time someone opens the page, unless the browser cache still has it. That download happens before the player sees anything, and on web portals players leave within seconds if a loading bar does not move. CrazyGames puts it plainly in their optimization guide (opens in a new tab): a smaller build improves the loading rate, and that improves revenue. An empty Unity project is already more than 10 MB uncompressed, because the engine itself (rendering, physics, UI, audio) ships inside the WebAssembly file. Compression gets that down to 2 to 4 MB. Which format you choose decides where in that range you land.

Size

Here are real build sizes from public sources.
BuildUncompressedGzipBrotliSource
Empty scene, Unity 2021.2, size optimizednot given2.9 MB2.2 MBUnity forum (opens in a new tab)
Small demo, Unity 2018.2, with TextMesh Pro and physicsnot givenabout 4 MBabout 3 MBJohannes Deml, Unity forum (opens in a new tab)
Mid-size game, Unity 2022.327.16 MBnot given5.37 MBMilton Candelero (opens in a new tab)
Production game, code + data22.1 MB + 8.5 MBnot given3.3 MB + 2.6 MBUnity forum (opens in a new tab)
Where both numbers are available, Brotli lands about 24 to 25 percent below gzip. That matches the lzbench 2.4 results (opens in a new tab) on the 211.9 MB Silesia corpus: Brotli level 11 left a file at 23.8 percent of the original, gzip level 9 at 31.9 percent, so the Brotli file is about 25 percent smaller. In Google's Brotli study (opens in a new tab) on the Canterbury corpus, Brotli level 11 reaches a ratio of 4.35 against 3.37 for gzip level 9, about 29 percent better. Those ratios put the Brotli file about 22.5 percent smaller. For a 4 MB gzip build that is about 1 MB less to download. On a 10 Mbit connection that is close to a second saved before the first frame. On a slow mobile connection it is several seconds.

Build time

Brotli at the quality Unity uses (the highest, level 11) is slow to compress. In the forum thread above, the build log showed the Brotli step alone taking 51 seconds for an empty scene. Google's study measured Brotli level 11 at 0.5 MB/s against 15.5 MB/s for gzip level 9, so roughly 30 times slower. On a 30 MB uncompressed build, that is the difference between a few seconds and about a minute of extra build time. It adds up when you build many times a day. Unity's manual says the same in its deployment page (opens in a new tab): Brotli files are smaller but take longer to compress, which increases iteration time on release builds. The good news is that this only affects release builds. Development builds are never compressed. And you can switch the setting to gzip or Disabled while testing and back to Brotli for the final build.

Decompression time

This is where the two formats stay close. In Google's study, gzip level 9 decompresses at 347 MB/s and Brotli level 11 at 290 MB/s. The other levels in that table sit between 323 and 355 MB/s. On the lzbench Silesia run, Brotli level 11 is faster: 383 MB/s against 318 MB/s for gzip level 9. For a 5 MB download that is a few milliseconds either way. The player will not notice. What the player will notice is who does the decompression. If your server sends the right Content-Encoding header, the browser decompresses the file natively while it is still downloading. If the header is missing, Unity's loader has to decompress the file in JavaScript after the download finishes. Unity prints a line in the browser console when this happens, something like "Decompressed in 82ms. You can remove this delay if you configure your web server." For a big build that delay is more like hundreds of milliseconds, and it also blocks WebAssembly streaming compilation, which normally lets the browser compile your code while it downloads. So the server setup matters more than the choice of format for load time.

Browser and server support

GzipBrotli
Browser supportAll browsersAbout 97 percent of users (Can I use (opens in a new tab))
Works over HTTPYesNo, HTTPS only
Response header neededContent-Encoding: gzipContent-Encoding: br
File extension from Unity.gz.br
Unity's documentation still says Brotli is supported by Chrome and Firefox only. That text is old. Safari has supported Brotli since version 11 in 2017, and Edge since version 15. The real restriction is HTTPS. Browsers do not announce Brotli support over plain HTTP at all. Your server must also serve .wasm.gz and .wasm.br files with Content-Type: application/wasm, otherwise streaming compilation does not work. Unity provides configuration samples (opens in a new tab) for Apache, Nginx and IIS. If you cannot change the server (itch.io is a common case), turn on Decompression Fallback in Publishing Settings. Unity then names the files .unityweb and ships a JavaScript decompressor. It works everywhere, but you pay the decompression delay described above.

Setting it from a build script

using UnityEditor; public static class WebBuildConfig { public static void UseBrotli() { PlayerSettings.WebGL.compressionFormat = WebGLCompressionFormat.Brotli; PlayerSettings.WebGL.decompressionFallback = false; } public static void UseGzipForTesting() { PlayerSettings.WebGL.compressionFormat = WebGLCompressionFormat.Gzip; } }

The decision

SituationPick
Publishing on HTTPS and you control the server headersBrotli
Publishing on a web portal that documents Brotli support, like CrazyGamesBrotli
Host that cannot set headers, or plain HTTPGzip, with Decompression Fallback if needed
Daily test buildsGzip or Disabled
You want to run your own compression stepDisabled, then compress with both formats and let the server pick
The last option is what web developers do outside Unity: keep the uncompressed .wasm, place a .wasm.br and a .wasm.gz next to it, and let the server send whichever the browser accepts. The Candelero article linked above walks through that setup. It gives you Brotli for 97 percent of players and gzip for the rest, with no fallback code. Brotli saves your players a quarter of the download. Gzip saves you a minute per build. Pick Brotli for the build that matters. For how each format gets there, see what gzip is and how it makes your files smaller and what Brotli is and why it beats gzip on the web.
00 views
00 shares

Discussion about this post

Comments are reviewed before they appear on the article.

No comments yet. Be the first to start the discussion.

Frequently asked questions

Newsletter

Stay in the Loop.

Subscribe to our newsletter to receive the latest news, updates, and special offers directly in your inbox. Don't miss out!