You click a link, a page opens, and a few seconds later you are playing. No installer ran and no app was added. What happens behind the scenes is straightforward.
What happens when the page loads
A browser game is a website. When you open it, your browser asks a server for the page and receives a set of files.
| File type | What it is | Role in a game |
|---|---|---|
| HTML | The structure of the page | Where the game sits and what surrounds it |
| CSS | The styling | Menus, buttons and layout |
| JavaScript | Program code | The rules, movement and logic of the game |
| WebAssembly | Compiled code | The same job as JavaScript, for games built in other languages |
| Images | Pictures and sprite sheets | Characters, backgrounds and interface art |
| Audio | Sound files | Effects and music |
| Data | Text files, often JSON | Levels, settings and translations |
Your browser downloads these, usually within seconds, and runs the code. From that point, everything happens on your own device. The browser acts as a small computer inside your computer, running the game in a tab.
Small games such as 2048 or Wordle are well under a megabyte. A 3D shooter such as Krunker is tens of megabytes. Either is tiny beside an installed game.
How the game draws and plays sound
Modern browsers have features built in that once needed plugins.
| Feature | What it does | Arrived |
|---|---|---|
| Canvas | A drawing surface the game paints shapes and images onto | First shipped by Apple in 2004, later standardized |
| WebGL | Access to the graphics chip for fast 2D and 3D | 2011 |
| Web Audio | Plays, mixes and positions sounds | Early 2010s |
| WebSockets | A live two-way connection to a server | 2011 |
| Gamepad support | Reads console controllers | Mid 2010s |
| WebAssembly | Runs code from languages such as C++ and Rust at close to full speed | 2017 |
| WebGPU | A newer, more capable link to the graphics chip | From 2023 |
WebAssembly is how large games built with engines such as Unity and Godot reach the web. Many smaller games are written directly in JavaScript, often with a framework such as Phaser or Three.js.
The game loop
At the heart of every action game is a loop that repeats many times a second.
- Read input. Which keys are down, where the mouse is, where fingers touch.
- Update the world. Move everything, check for collisions, apply the rules.
- Draw the result.
- Wait for the next frame, then repeat.
The browser offers a way for a game to run this loop in step with the screen. On a 60 Hz display the loop runs 60 times a second, giving the game 16.7 milliseconds to do all three steps. If the work takes longer, a frame is missed and the game stutters.
When you switch to another tab, most browsers pause or slow the loop to save power, which is why a game may freeze in the background and why a well-made one pauses itself.
The same game often has to work with a keyboard and mouse on a computer and with fingers on a phone. Browsers report all of these, and a well-made game listens for each, which is why it can show on-screen sticks on a phone and none on a laptop.
Saving and multiplayer
A browser game can store data on your device, in storage the browser keeps separately for each website.
| Storage | Typical limit | Used for |
|---|---|---|
| Cookies | A few kilobytes | Sign-in and preferences |
| Local storage | About 5 megabytes per site | Progress, settings, best scores |
| IndexedDB | Much larger | Bigger saves and downloaded game files |
| Cache storage | Large | Keeping the game's own files so it loads faster, or offline |
This is why clearing your browsing data can erase a save, why a private window forgets everything when closed, and why progress does not follow you to another device unless the game offers an account or a backup code.
For multiplayer, the game keeps a connection open to a server, usually a WebSocket, and exchanges small messages many times a second. The server passes information between players, decides disputes and keeps things fair. Games such as Agar.io, Slither.io and Krunker work this way. A newer technology, WebRTC, lets browsers also talk directly to each other, which some games use for voice or for two-player matches.
What can go wrong, and how to fix it
| Problem | Likely cause | Fix |
|---|---|---|
| The game will not start | An old browser, or a blocked script | Update the browser. Try turning off extensions for that site |
| No sound | Browsers block audio until you interact | Click or tap the game once |
| Choppy graphics | Hardware acceleration is off, or too many tabs | Turn it on in the browser's settings, and close other tabs |
| Progress vanished | Browsing data was cleared, or you used a private window | Use a normal window and the same browser each time |
| Laggy multiplayer | Network delay | Move closer to the router, or use a cable |
| The keyboard scrolls the page | The game does not have focus | Click inside the game, or go full screen |
| Freezes when you switch tabs | The browser paused the tab | Keep the game in the front tab |
| Black screen | Graphics driver trouble | Update your graphics drivers, or try another browser |
Because everything runs inside the browser's own safety boundary, a browser game cannot reach into the rest of your device the way an installed program can. And because nothing is installed, trying one costs you only a few seconds. A complete game arrives the same way a web page does and works on almost any device with a browser.