Browser games
Exporting a Godot Game to the Web: Settings, Threads and Load Size
To export a Godot 4 game to the web, build it with the Compatibility renderer, install the web export templates, decide whether you need thread support (which requires special cross-origin isolation headers from your host), serve the files compressed, and test on real browsers and phones. Most problems with Godot web builds come from those headers, from the download size, and from projects that use features the web platform does not support.
Godot is a popular choice for browser games because it is free, light and exports to HTML5 directly. The web export still has its own rules. This guide covers the settings and decisions we work through when shipping Godot games in our browser game development services.
What the web export produces
A Godot web export is a set of files: an HTML page, a JavaScript loader, the engine compiled to WebAssembly, and a .pck file with your game's data. Optionally it adds files for a progressive web app. The browser downloads the engine and the pack, starts the engine, and runs your game in a canvas using WebGL 2.
The engine itself is a fixed cost in every build, and your pack adds on top. That is why a small Godot web game still has a noticeable minimum download, and why the size tips below matter.
Step 1: Use the Compatibility renderer
Godot 4 has three rendering methods: Forward+, Mobile and Compatibility. Web exports use Compatibility, which runs on WebGL 2. If you developed with Forward+, switch early and check your scenes, because some features look different or are not supported in Compatibility. Lighting, post-processing and certain shader features are the usual suspects.
The best time to discover this is in the first prototype. If the browser is a main target, develop in Compatibility from day one.
Step 2: Decide on thread support
This is the setting that causes the most confusion. Multithreaded WebAssembly relies on SharedArrayBuffer, which browsers only enable on pages that are cross-origin isolated. That requires your server to send two HTTP headers with the game page:
Cross-Origin-Opener-Policy: same-originCross-Origin-Embedder-Policy: require-corp(or a compatible value)
Early Godot 4 releases required these headers for every web export, which made hosting difficult. Since Godot 4.3, you can export without thread support, so the game runs without cross-origin isolation. Check the thread support option in the web export preset for your version.
| Option | Pros | Cons |
|---|---|---|
| Without thread support | Runs on any static host and most portals without special headers; simpler embedding | No multithreading; heavy work can cause hitches |
| With thread support | Can use threads for heavier workloads | Needs cross-origin isolation headers; isolation can break third-party embeds, ads and some analytics scripts |
For most browser games, advergames and portal releases, exporting without threads is the pragmatic default. Choose threads only if profiling shows you need them and you control the hosting.
Step 3: Check feature compatibility
Some features behave differently or are missing on the web. Review these before you commit:
- C# projects. Web export for Godot 4 projects using C# has historically not been available. Check the current status in the Godot documentation before choosing C# for a browser game.
- Native extensions. GDExtension libraries must be compiled for the web, which not every add-on supports.
- File access. Saves use the browser's storage, which the player or browser can clear. Offer cloud saves or export codes for long games.
- Audio. Audio starts only after a user interaction. Use a start screen and test audio carefully in single-threaded builds.
- Networking. Browsers cannot open raw UDP or TCP sockets. Use WebSocket or WebRTC for multiplayer. Our guide to multiplayer browser games explains the options.
- Input. Mouse capture, fullscreen and gamepads work through browser APIs with their own rules, usually requiring a user gesture first.
Step 4: Reduce load size
Load time decides whether players stay. Work on both the engine and your content:
- Compress on the server. Serve the .wasm and .pck with Brotli or gzip compression. This is the single easiest win, and most hosts and CDNs support it with configuration.
- Trim the engine. Godot can be compiled from source with unused modules disabled, for example the 3D engine for a 2D game. Custom export templates take effort to set up but shrink the engine.
- Compress textures sensibly. Use import settings that suit the web, and avoid shipping huge source textures.
- Compress audio. Use Ogg Vorbis for music and short compressed clips for effects instead of WAV.
- Exclude unused files. Use export filters so test scenes and source assets stay out of the pack.
- Split content. Large games can load additional resource packs after the first level starts.
For general techniques that apply to any engine, see how to make a browser game load fast.
Step 5: Customize the loading page
The default HTML shell works but looks generic. Godot lets you provide a custom HTML shell. Use it to show your brand, a progress bar and a "tap to play" button that unlocks audio. Keep the shell light so it appears instantly while the engine downloads.
Step 6: Host it correctly
- Serve .wasm files with the
application/wasmMIME type. - Enable compression and long cache lifetimes for versioned files.
- Add the cross-origin isolation headers if you exported with threads.
- Use a CDN for global audiences. Ninja Fighters, our browser fighting game, is served through Cloudflare.
If you publish on web portals, check each portal's requirements for builds, SDKs, headers and file sizes in their current developer documentation. Our guide to publishing on web game portals covers that process.
Step 7: Test where players are
Test in Chrome, Firefox and Safari on desktop, and on real iPhones and Android phones. Mobile browsers have tighter memory limits and their own audio and fullscreen behavior; our guide to making browser games work on phones lists what to check.
Godot web export checklist
- Compatibility renderer used and visuals checked in the browser.
- Thread support decision made, with headers configured if enabled.
- No unsupported features such as C# or native-only add-ons, or a plan for them.
- Server compression enabled; MIME types correct.
- Export filters exclude unused files; audio and textures compressed.
- Custom shell with progress bar and tap to start.
- Saves survive reloads, with a plan for cleared storage.
- Tested on desktop browsers and real phones.
When to bring in a studio
Small Godot games often export cleanly with the defaults. A studio helps when the build is too large, when custom engine templates are needed to cut size, when multiplayer must work over WebSocket or WebRTC, or when a Forward+ project has to be adapted to the Compatibility renderer.
paxl.co ships browser games in Godot and other web frameworks, and ports existing games to the web through our porting and co-development work. A typical project takes 3–4 months from kickoff to launch. Learn more about our browser game development.
FAQ
Why does my Godot web game show a SharedArrayBuffer or cross-origin isolation error?
The build was exported with thread support, which needs the page to be served with cross-origin isolation headers. Either configure those headers on your host or export without thread support, which recent Godot 4 versions allow.
Can I export a Godot 3D game to the web?
Yes. Use the Compatibility renderer, keep models and textures light and test performance on mid-range phones. Some advanced lighting and effects from Forward+ are not available, so plan the look accordingly.
Should I use Godot 3 for web games instead?
Godot 3 is older and no longer the focus of development. For new projects, Godot 4 with a single-threaded web export is usually the better starting point. Existing Godot 3 web games can keep running, but plan upgrades carefully.