What is WebGL?
WebGL is a JavaScript API for rendering interactive 2D and 3D graphics directly in a web browser, with no plugins required. It gives web pages direct access to a device's GPU, so it can render sophisticated visuals without specialized software.
How does WebGL work?
WebGL gives a web page a standardized interface to a device's GPU, supported by every modern browser on both desktop and mobile.
When Unity builds a project for WebGL:
- Unity compiles the project's C# scripts to C++.
- That C++ compiles to WebAssembly, which the browser runs at near-native speed.
- Unity also generates the JavaScript, HTML, and data files needed to load and display the build.
How is WebGL used?
In Unity specifically, WebGL is a build target. Choosing it in Build Settings lets a game run directly in a browser with no install, download, or app store submission, using a real SDK toolchain under the hood. This makes it a natural fit for browser-playable games, interactive ads, product configurators, and educational simulations, anywhere a developer wants a player to click a link and start playing immediately. It's one of 25+ platforms Unity can export the same project to, alongside mobile, desktop, and console.
What are the benefits of using WebGL?
- Skip app store review: Ship and update a WebGL build without waiting on app store approval.
- Remove install friction: Players click a link and start playing immediately, no download required.
- Reach every platform at once: A single WebGL build runs on any modern browser, desktop or mobile.
What are the challenges of using WebGL?
- Narrower performance ceiling: A WebGL build generally can’t match a native build’s performance, especially for demanding 3D content, though the gap has narrowed over time.
- Build size and load time: Players wait for the build to download before playing, so asset size and compression matter more than on a native install.
- Device and browser variance: Actual performance depends on the player’s specific GPU and browser, not just whether WebGL is nominally supported.
Frequently asked questions (FAQ)
Which browsers support WebGL?
All modern browsers support WebGL, including Chrome, Firefox, Safari, and Edge, on both desktop and mobile. See Unity’s own WebGL browser compatibility documentation for the specifics that apply to a Unity WebGL build.
Can a WebGL build run on mobile?
Yes. Mobile browsers on both iOS and Android support WebGL, though mobile GPUs and memory limits mean a mobile WebGL build usually needs more aggressive optimization than a desktop-targeted one.
Related terms
Software Development Kit (SDK)