← Blog

How to export and host a Godot 4 web game

Updated · 3 min read

To host a Godot 4 web game cleanly, choose the Compatibility renderer, decide early between Godot 4.3+'s single-threaded export (works anywhere) or multi-threaded export (requires COOP/COEP headers), compress your .pck assets, and deploy the exported folder to a host that serves WebAssembly with the right headers.

1. Pick the right renderer and thread mode in Godot 4

  • Renderer: Always use Compatibility (OpenGL ES 3 / WebGL 2) for web exports. Forward+ and Mobile rely on Vulkan/WebGPU features that are not universally supported in browsers.
  • Single-threaded vs. Multi-threaded (Godot 4.3+):
    • Single-threaded (Thread Support unchecked): Does not require SharedArrayBuffer or COOP/COEP headers, so it works on GitHub Pages and embedded iframes out of the box—and avoids audio crackling bugs on some browsers.
    • Multi-threaded (Thread Support checked): Faster for heavy physics/C++/GDExtension workloads, but requires Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp headers on your web host (see How to fix SharedArrayBuffer errors).

2. Export your web bundle

  1. Open Project → Export → Add… → Web.
  2. Install the matching export templates if prompted.
  3. Export into an empty folder (for example export/web/) with index.html as the filename.
  4. Test locally with a real HTTP server (opening index.html directly via file:// will fail due to CORS):
python3 -m http.server 8000 --directory export/web

(If you enabled Thread Support, use Godot's built-in Run in Browser button or Vite/Node with COOP/COEP headers locally.)

3. Keep your .pck and .wasm download fast

Godot 4 web exports ship a ~30–40 MB .wasm engine binary plus your .pck asset archive. To keep load times bearable:

  • Compress textures: Use VRAM Compressed (WebP/Lossy) for large sprites and 3D textures instead of uncompressed PNGs.
  • Use Ogg Vorbis for music and keep .wav only for short, low-latency sound effects.
  • Strip unused modules only if you're building custom export templates—for most indies, optimizing textures and audio gets 80% of the savings with zero engine rebuilds.
  • Note on updates: Normally, changing one script rebuilds the .pck and forces testers to re-download the entire archive. Hosts that use FastCDC content-defined chunking (like Pita) split the .pck and .wasm into cached chunks so small updates only transfer the bytes that actually changed.

4. Where to host your Godot 4 web export

  • itch.io: Zip the contents of export/web/ (with index.html at the root), upload as HTML5, and check SharedArrayBuffer support if you enabled Thread Support.
  • Cloudflare Pages: Deploy export/web/ via wrangler pages deploy export/web and add a _headers file if using Thread Support. Watch Cloudflare's 25 MB single-file limit—a Godot 4 .wasm binary can exceed 25 MB!
  • Pita: Point [client] artifact = "export/web" in pita.toml and run pita publish --to production (or let your coding agent run it). Pita supports builds up to 1 GiB on both Free ($0) and Basic ($14/mo) with no 25 MB per-file ceiling, configures COOP/COEP headers automatically on an isolated game origin, and caches .wasm/.pck chunks via FastCDC so playtest updates load in seconds.

FAQ

Why does Cloudflare Pages reject my Godot 4 .wasm file?

Cloudflare Pages enforces a 25 MiB per-file limit, and a default Godot 4 web export's .wasm file is often 30–40 MiB uncompressed. You either need a custom stripped Godot export template, single-file hosting elsewhere (like itch.io or Pita), or R2/S3 with custom headers.

Why is audio silent when my Godot web game first loads?

Browsers block WebAudio until the user interacts with the page (click or keypress). Show a clean title screen or "Click to start" button before playing background music.

Related guides