Web Game File Size: Limits and How to Stay Under Them

Web Game File Size: Limits and How to Stay Under Them

Direct answer: Most HTML5 portals cap uploads at 20MB (some at 50MB), but the performance target should be far lower — under 2MB gzipped if you can. Our Phaser game ships at ~4.4MB raw / ~1.8MB gzipped, and it stays well under every portal limit while loading fast on 4G.

Here is the size math from our actual build, and the three settings that got us there.

1. The limits that actually exist

GateTypical limitNotes
CrazyGames upload~50MBGenerous, but load time still matters for retention
Poki~50MBSame: limit ≠ good idea
Most portals20MBA common hard ceiling
Player patience~2MB gzippedThe limit that decides whether people play

Portals set limits so the file uploads; players set the real limit with their thumbs. A 20MB game on 4G takes several seconds before the first frame — that is a lost player, not a broken upload.

2. What our build ships (real numbers)

Phaser 3.90 + Vite, one texture atlas, ~40 audio files (OGG):

Total raw:      ~4.4 MB
Gzipped:        ~1.8 MB
Engine share:   most of it — Phaser is the heavy dependency

The engine is the whale. Phaser core plus dependencies is often 1MB+ compressed by itself, before you add a single asset. That is normal — what matters is that your assets don’t double it.

3. The three Vite settings that matter

// vite.config.js
export default defineConfig({
  base: './',                          // 1. deployable to any subdirectory
  build: {
    assetsInlineLimit: 0,              // 2. keep assets as files, not base64
    rollupOptions: {
      output: {
        manualChunks: { phaser: ['phaser'] }  // 3. separate engine chunk for caching
      }
    }
  }
});

4. Asset-side wins (bigger than config)

Common mistakes


Written by ruofan, independent HTML5 game developer. Build numbers come from Merge Fish 2048 (Phaser 3.90 + Vite), measured from npm run build. Config reference: Vite build docs.