# How to reduce HTML5 package size?

**URL:** <https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999>\
**Category:** Plugins\
**Tags:** package, size, Optimization, HTML5, unreal-engine, Plugins, question\
**Created:** [December 8, 2014, 7:39pm UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999 "2014-12-08T19:39:05Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![trutty](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@trutty](https://forums.unrealengine.com/u/trutty)\
**Post date:** [December 8, 2014, 7:39pm UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/1 "2014-12-08T19:39:05Z")

</div>

I am using UE 4.6 and developing a HTML5 game. I want the final package size to be as small as possible but right now, it seams that a lot of unnecessary stuff gets packed into it.

I work with Blueprints. The size of the content folder, including all assets, is 18.5 MB and the resulting HTML5 package is about 74 MB

![23347-package-sizes.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/8/a/08a3b147dd932e1f2ebc11ea6bde24477d37585e.jpeg)

I researched some possibilities to minimise the size. Here is what I did:

- project has no starter content

- used assets do not reference to assets in the engine folder (except for MatineeCam) (checked with the Reference Viewer on my map)

- packaging settings are set to “Full Rebuild”, “Full Distribution” and “Shipping”

- excluded " /Engine/MobileResources" from content directories

- disabled Slate

- disabled plugins in the editor and checked in the uproject file:

- modified .target.cs

The thing is, that even though I disabled all plugins etc. the resulting .data.js file still references these assets, which I am definitively not using. Even the standard “Entry.umap” is listed but this map doesn’t even exist. Here is a small excerpt of these unwanted files:

 ![23349-unused-plugins-in-data-js.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/0/c/10c2c251dfc2371b85678e95c41acea5259941a4.jpeg)

 ![23350-unused-assets-in-data-js.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/9/6/99658e4a5a0576c86e636124d64c708cd3105629.jpeg)

The TappyChicken demos’ .data.js loads way less assets than mine.  
What can I do to get rid of unnecessary stuff? Maybe I am just missing a detail. Any comment will help! Thanks

**Update**

I am now using UE 4.6.1, started a completely fresh project and implemented everything in C++. Unfortunately this changed nothing with the package size. I did a full memreport ([Debugging and Optimizing Memory][4]) but had no luck in optimizing. I really hope this will get better.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_83949151](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_83949151](https://forums.unrealengine.com/u/anonymous_user_83949151)\
**Post date:** [December 9, 2014, 10:22am UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/2 "2014-12-09T10:22:29Z")

</div>

I have the same problem. You have more options to packaging project with UnrealFrontend, but I have not been able to improve the result.  
I continue investigating for this problem, if i have got lucky, I’ll publish my results in this post.

---

<div class="post-metadata">

**Author:** ![piXelicidio](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pixelicidio/32/983228_2.png) [@piXelicidio](https://forums.unrealengine.com/u/piXelicidio)\
**Post date:** [December 18, 2014, 10:19pm UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/3 "2014-12-18T22:19:09Z")

</div>

I think I’m collecting (bookmarking) this kind of package-size questions that are never answered. Is very sad. The only thing that could take me away from making mobile games with UE4 is the ridiculous big file size.

---

<div class="post-metadata">

**Author:** ![Moss](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/moss/32/704032_2.png) [@Moss](https://forums.unrealengine.com/u/Moss)\
**Post date:** [January 14, 2015, 5:26pm UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/4 "2015-01-14T17:26:40Z")

</div>

To shrink the size of a HTML5 deployment I recommend you to pre-gzip the content, I was able to get the final size to about 15 MB for the engine and the game for an HTML project (just select the big blue button [https://ikea.pr/puertorico/desktop/es\_pr/catalogos/categoria/escenario/detalle/apartamento-de-verano\_PR](https://ikea.pr/puertorico/desktop/es_pr/catalogos/categoria/escenario/detalle/apartamento-de-verano_PR)).

Once you have gzipped your content (apache example: [Serving pre-compressed files using Apache](http://feeding.cloud.geek.nz/posts/serving-pre-compressed-files-using/)) you have two options, always serve gzip or serving both and if the client is able to read gzip content serving the gzipped version. Deciding if the client can handle gzip is easy, just create a .js file, gzip it to .js.gzip (gzip with the _-9_ option which indicates best compression rates) and try to load it. If you add a variable in that file like **var enable\_gzip = true;** and your client can load that file the **enable\_gzip** will be defined, if not **enable\_gzip** will be undefined and you can change the extension you request from the server.

From you file sizes the engine should go under 10 MB and the game around 6 MB.

---

<div class="post-metadata">

**Author:** ![trutty](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@trutty](https://forums.unrealengine.com/u/trutty)\
**Post date:** [January 14, 2015, 6:25pm UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/5 "2015-01-14T18:25:20Z")

</div>

Thanks for your reply and the examples, Moss. I looked at your example and it turns out that I downloaded around 37 MB (CloudStore.data.jgz alone is already 27.5 MB large).  
I already transfer my data compressed (forgot to mention that; currently using deflate but I am going to check out gzip), however I forgot to include the \*.mem file in the compression filter which now saved me another 6.5 MB.

Afaik transferring the data compressed is only good for the downloading purpose but after all the users browser still has to load the full uncompressed files in the memory and needs to deal with them - my actual question is how to reduce the package size in the first place because there really is a lot of unnecessary stuff in the package.

Thanks anyway. This is helpful for others, too.

---

<div class="post-metadata">

**Author:** ![piXelicidio](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pixelicidio/32/983228_2.png) [@piXelicidio](https://forums.unrealengine.com/u/piXelicidio)\
**Post date:** [January 14, 2015, 7:01pm UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/6 "2015-01-14T19:01:19Z")

</div>

That’s the same problem I have with android non-source project. Is not about game content compression, is the whole engine is included in the package and the smallest .apk size I could achieve is 36MB with only 2MB of my actual game content.  
If Epic wants to continuew advertising that UE4 produce games for android and HTML5 they need to do something to reduce engine package size. Also this solution has to be easy for us, because to reduce my package size from 54MB to 36MB i had to do a lot of tricks, some of them a bit dirty.

---

<div class="post-metadata">

**Author:** ![Moss](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/moss/32/704032_2.png) [@Moss](https://forums.unrealengine.com/u/Moss)\
**Post date:** [January 15, 2015, 8:24am UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/7 "2015-01-15T08:24:11Z")

</div>

HTML5 is still experimental so it will get better for sure 😃

---

<div class="post-metadata">

**Author:** ![Moss](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/moss/32/704032_2.png) [@Moss](https://forums.unrealengine.com/u/Moss)\
**Post date:** [January 15, 2015, 8:30am UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/8 "2015-01-15T08:30:47Z")

</div>

Without pre-compression the browser was not able to even download the build and crashed with Out of Memory errors.

I guess the only way to get rid of all those plugins and additional is really using a source release and not compile the plugins. If you disable the plugins for the project from the editor are they getting included too?

---

<div class="post-metadata">

**Author:** ![trutty](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@trutty](https://forums.unrealengine.com/u/trutty)\
**Post date:** [January 15, 2015, 9:01am UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/9 "2015-01-15T09:01:25Z")

</div>

> I guess the only way to get rid of all those plugins and additional is really using a source release and not compile the plugins.

Do you know how I can achieve that?

> If you disable the plugins for the project from the editor are they getting included too?

Yes, I uncheck the plugins in the Plugins Browser (Window → Plugins) and check if they are disabled in my uproject file, too. Still they get included.

---

<div class="post-metadata">

**Author:** ![Moss](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/moss/32/704032_2.png) [@Moss](https://forums.unrealengine.com/u/Moss)\
**Post date:** [January 15, 2015, 9:04am UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/10 "2015-01-15T09:04:41Z")

</div>

You can either delete them from the Engine/Plugins folder (might be tricky). Or set them to be ‘Editor’ or ‘Developer’ plugins instead of ‘Runtime’ plugins in the .uplugin files.

I have not tried it but that would be the starting point.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_83949151](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_83949151](https://forums.unrealengine.com/u/anonymous_user_83949151)\
**Post date:** [January 21, 2015, 12:13pm UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/11 "2015-01-21T12:13:42Z")

</div>

Very good post!! We reduced our project 40 MB with this compresion.  
You must to active de mod\_deflate module in Apache and add .htaccess with this code on the hosting site:

```
#LoadModule deflate_module modules/mod_deflate.so

<IfModule mod_deflate.c>

    # Activamos la compresión
    SetOutputFilter DEFLATE

    # Indicamos los tipos de contenido a comprimir
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/gml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/json
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE data

    # Indicamos las extensiones de los ficheros a comprimir
    <files *.html>
        SetOutputFilter DEFLATE
    </files>
    <files *.xml>
        SetOutputFilter DEFLATE
    </files>
    <files *.gml>
        SetOutputFilter DEFLATE
    </files>
    <files *.json>
        SetOutputFilter DEFLATE
    </files>
    <files *.js>
        SetOutputFilter DEFLATE
    </files>
    <files *.css>
        SetOutputFilter DEFLATE
    </files>
    <files *.data>
        SetOutputFilter DEFLATE
    </files>

</IfModule>

```

But we need more. Do you know if we can reduce the resolution, qualities or engine escalability settings to package in HTML5?  
Do you know how can we compress de .DATA file?  
Thanks!!

---

<div class="post-metadata">

**Author:** ![Moss](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/moss/32/704032_2.png) [@Moss](https://forums.unrealengine.com/u/Moss)\
**Post date:** [January 21, 2015, 12:31pm UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/12 "2015-01-21T12:31:22Z")

</div>

You can add a HTML5 engine ini file and lower the TEXTURE group sizes for all. Just go into base engine ini file and you copy the TEXTUREGROUP settings over to your HTML5 engine ini file, then just lower the max lod size, I use 1024 or 512 and it’s still quite nice. You can also change the filters and tweak them a bit.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2f922134](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2f922134](https://forums.unrealengine.com/u/anonymous_user_2f922134)\
**Post date:** [April 23, 2015, 7:57pm UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/13 "2015-04-23T19:57:29Z")

</div>

Hello there,

after looking into this for my own HTML5 project, I noticed that by default, the plugin configuration in the .uproject file is not allowed to disable default plugins. To fix this, edit Engine/Source/Programs/UnrealBuildTool/System/UProjectInfo.cs in GetEnabledPlugins and replace  
List EnabledPlugins = new List(DefaultEnabledPlugins);  
with  
List EnabledPlugins = new List();  
( for me, it’s line 313 )

Then recompile while specifying the uproject file, that is using  
Engine/Build/BatchFiles/Mac/Build.sh UE4Game HTML5 Shipping /path/to/your.uproject  
instead of  
Engine/Build/BatchFiles/Mac/Build.sh UE4Game HTML5 Shipping

And voila, only the modules you enabled are compiled and linked into your HTML5 runtime 🙂

---

<div class="post-metadata">

**Author:** ![piXelicidio](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pixelicidio/32/983228_2.png) [@piXelicidio](https://forums.unrealengine.com/u/piXelicidio)\
**Post date:** [April 23, 2015, 10:12pm UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/14 "2015-04-23T22:12:47Z")

</div>

Hi, you think I can apply your solution to an android project?  
Do i need to know anything about c++?

---

<div class="post-metadata">

**Author:** ![jwatte](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jwatte/32/744941_2.png) [@jwatte](https://forums.unrealengine.com/u/jwatte)\
**Post date:** [April 24, 2015, 5:48pm UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/15 "2015-04-24T17:48:08Z")

</div>

This solution works for any platform. However, you need to know a small amount of C# to actually make that code edit, and re-run the build files.

---

<div class="post-metadata">

**Author:** ![piXelicidio](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pixelicidio/32/983228_2.png) [@piXelicidio](https://forums.unrealengine.com/u/piXelicidio)\
**Post date:** [April 24, 2015, 5:50pm UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/16 "2015-04-24T17:50:35Z")

</div>

C# or C++? I can understand simple C++ code but I don’t know anything about visual studio. Do I need to install Visual Studio? and re-compile something or It will work with my blueprint only project? Thanks for your patience 🙂

---

<div class="post-metadata">

**Author:** ![Moss](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/moss/32/704032_2.png) [@Moss](https://forums.unrealengine.com/u/Moss)\
**Post date:** [May 2, 2015, 6:32pm UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/17 "2015-05-02T18:32:38Z")

</div>

You will have to compile the engine from source. [Here](https://wiki.unrealengine.com/GitHub_Setup) you have a complete tutorial on how to compile the engine from sources.

---

<div class="post-metadata">

**Author:** ![6r0m](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/6r0m/32/1194563_2.png) [@6r0m](https://forums.unrealengine.com/u/6r0m)\
**Post date:** [December 7, 2016, 1:56pm UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/18 "2016-12-07T13:56:05Z")

</div>

could you please update you answer for current engine? I can’t find this strokes.

---

<div class="post-metadata">

**Author:** ![Luiz\_Sotero](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Luiz\_Sotero](https://forums.unrealengine.com/u/Luiz_Sotero)\
**Post date:** [August 3, 2017, 7:54pm UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/19 "2017-08-03T19:54:27Z")

</div>

I’m having the same problem here, but the UProjectInfo file does not have the same code from this answer. Can anyone update the answer to reflect new changes?

---

<div class="post-metadata">

**Author:** ![SRombauts](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SRombauts](https://forums.unrealengine.com/u/SRombauts)\
**Post date:** [November 14, 2017, 9:55am UTC](https://forums.unrealengine.com/t/how-to-reduce-html5-package-size/300999/20 "2017-11-14T09:55:04Z")

</div>

Just a quick note since I was looking for MaxLODSize, it now has it’s default values (4096) in [Engine/Config/BaseDeviceProfiles.ini](https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Config/BaseDeviceProfiles.ini)

`[/Script/Engine.TextureLODSettings] @TextureLODGroups=Group TextureLODGroups=(Group=TEXTUREGROUP_World,MinLODSize=1,MaxLODSize=4096,LODBias=0,MinMagFilter=aniso,MipFilter=point,MipGenSettings=TMGS_SimpleAverage) `
