Skip to content
AI-powered appsNewChat, vision, voice, generationBookings & schedulingAppointments that book themselvesShops & sellingA storefront in every pocketClient & businessRun the operation from one placeCommunities & clubsA home that is not a group chat
Health & wellnessHabits, tracking and calmGames2D, 3D and multiplayerPersonal & toolsThe tool you wish existedInternal toolsThe tool ops never had time for
See all use cases
ArcadeNewPricingSecurity
EngineThe game engine and World EditorHow it worksFrom one sentence to a live productDocsGuides for building and publishingBlogStories, guides and newsChangelogWhat shipped latelyStatusUptime of every serviceSupportGet help from the team
AI-powered appsBookings & schedulingShops & sellingClient & businessCommunities & clubsHealth & wellnessGamesPersonal & toolsInternal tools
See all use cases
ArcadeNewPricingSecurity
EngineHow it worksDocsBlogChangelogStatusSupport
Language
Blog
Game designNovember 22, 20265 min read

How to Save Game Progress in a Web Game

Losing progress is the fastest way to lose a player. Here is how to design save data, store it in the browser, back it up to the cloud and keep it safe across updates.

Startbase Team
Editorial ink illustration of a brass key on a hook beside a small locked wooden chest, the key in ember orange

Key takeaways

  • Save the minimum state that recreates the player's progress, as one small versioned object.
  • Browser storage is quick and free but can be cleared; treat it as a cache unless players have accounts.
  • Cloud saves need sign-in. Let people play first as guests and offer an account when they have something worth keeping.
  • Save often, write atomically, and migrate old save versions instead of discarding them.

To save progress in a web game, store a small, versioned object describing the player's progress (unlocked levels, best scores, currency, settings) in the browser's localStorage or IndexedDB, and write it whenever something important changes. Browser storage is instant and needs no accounts, but it lives on one device and can be cleared, so for progress players care about, add cloud saves: a database row per player, tied to a sign-in, that syncs when they play on any device.

Decide what to save

Save data should be the smallest set of facts that lets the game recreate where the player is. Do not save the whole game world; save what the player has earned and chosen. A typical structure for a level-based game:

  • version: a number for the save format, starting at 1.
  • progress: highest level unlocked, stars or best time per level.
  • economy: coins, gems and owned items or characters.
  • stats: total plays, best score, longest streak.
  • settings: volumes, control scheme, reduced motion, language. Often stored separately so they survive a progress reset.
  • timestamps: when the save was last written, used to resolve conflicts between devices.

Mid-level saves (exact enemy positions, health mid-fight) are much harder and rarely needed in short browser games. A checkpoint system (save the last checkpoint reached and the player's inventory at that moment) gives most of the benefit with a fraction of the complexity.

Tip

Store IDs, not positions in a list. Save "unlocked: ['forest-1', 'forest-2']" rather than "unlocked up to index 2", so adding or reordering levels in an update does not scramble existing saves. Database basics for non-developers explains IDs and rows if this is new.

Local saves in the browser

Browsers offer two practical options:

  • localStorage: a simple key-value store of strings. Write your save object as JSON under one key. Fast, synchronous and plenty for typical save data (browsers commonly allow around 5 megabytes per site).
  • IndexedDB: an asynchronous database for larger or structured data, such as user-made levels, replays or screenshots.

Local saves have real limits players will not expect, so design around them:

  • One browser, one device: progress on a phone does not appear on a laptop, or even in another browser on the same phone.
  • Private browsing often discards storage when the window closes.
  • Clearing site data wipes saves. Some browsers, notably Safari, may also remove storage for sites the person has not interacted with for a while.
  • Address matters: storage belongs to the exact site address. Moving the game from a preview address to its published address, or to a custom domain, starts with empty storage.

Writing saves safely

  1. 01Save at meaningful moments: level complete, purchase, checkpoint, settings change. Also save when the page is hidden (the visibilitychange event), because mobile browsers can kill a backgrounded tab without warning.
  2. 02Write the whole object at once: build the new save in memory, then write it in one operation. Never write half of it.
  3. 03Validate on load: if parsing fails or required fields are missing, fall back to a backup copy rather than crashing or silently resetting.
  4. 04Keep a backup: write the previous good save to a second key before overwriting. Corruption is rare but devastating.
  5. 05Migrate versions: when the format changes, write a function that upgrades version 1 saves to version 2, and so on. Never discard old saves because they look different.

Never trust the save for anything competitive. Anything stored on the player's device can be edited by the player. That is fine for single-player progress, and it is exactly why leaderboards need a server check, as our leaderboards guide explains.

Cloud saves with player accounts

Cloud saves store progress on a server, keyed to a player account, so it follows the player across devices and survives cleared browsers. You need three things: sign-in, a table to hold save data, and rules so each player can only read and write their own row. Row level security explained covers that rule in detail.

In Startbase, Startbase Cloud adds a managed backend with a database and authentication to your project. Its authentication options include email and magic link, Google, Apple, phone and anonymous users, which let people try the app before creating an account. That fits games well: a player can start as a guest, and you prompt them to create an account at a moment when they have progress worth protecting.

A simple cloud save design:

  • A table of saves with the player's user id, the save JSON, the save version and an updated time.
  • Row-level rules so a player can only access the row with their own id.
  • On launch: load the local save instantly so the game starts fast, then fetch the cloud save in the background.
  • On conflict (both changed since the last sync): prefer the save with more progress, or ask the player which to keep, showing the level and date of each. Avoid silently keeping the newest timestamp, which can throw away a long session from another device.
  • On write: save locally first, then push to the cloud. If offline, retry later.

When to ask players to sign up

Asking for an account before the first level costs you players. Asking after they have invested makes the offer feel like protection rather than a gate. Good moments:

  • After the first world or the first few levels, with a message like "Save your progress to play on any device".
  • Before the first purchase or the first leaderboard submission.
  • When the player opens the game on a second device.

Make it skippable, and keep the game fully playable without an account. A short, honest explanation of what an account does (sync progress, protect it) works better than a generic sign-up screen. User authentication explained covers the sign-in options and how they work.

A brief for a save system

Add saving to my puzzle game. Save object, version 1: unlocked level ids, stars per level id, coins, owned skin ids, and settings (music volume, effects volume, reduced motion) stored separately. Save locally on level complete, purchase, settings change and when the page is hidden; keep the previous save as a backup and fall back to it if the main one fails to load. Then enable Startbase Cloud: let players start as anonymous guests, store saves in a table only the owner can read and write, and after world 1 show a skippable "Save your progress to play on any device" prompt. On load, start from the local save and merge the cloud save by keeping the one with more stars.

Common save system mistakes

  • Saving only on exit. Mobile browsers rarely give you a clean exit. Save during play.
  • No version number, so the first update that changes the format breaks every existing save.
  • Index-based progress that scrambles when levels are added.
  • Silent resets when a save fails to parse. Use a backup and log the error.
  • Forcing sign-up first. Players who have not played yet have nothing to protect.
  • Testing only fresh saves. Before each update, load a save from the previous version and make sure it still works.

Save systems are a quiet part of the core game loop: the long-term loop only works if progress is still there tomorrow. Test it by playing, closing the tab, clearing nothing, and coming back on another device.

Frequently asked questions

How do browser games save progress?

Most store a small JSON object in localStorage or IndexedDB in the player's browser. Games that need progress across devices also save to a server database tied to a player account.

Can players lose progress saved in localStorage?

Yes. It is tied to one browser on one device, private browsing may discard it, clearing site data wipes it, and some browsers remove storage for sites not used in a while. Cloud saves protect against this.

Do I need user accounts for cloud saves?

You need some identity to know whose save is whose. Anonymous guest sessions let players start without signing up; you can then offer a full account once they have progress worth keeping.

On this page

  • Decide what to save
  • Local saves in the browser
  • Writing saves safely
  • Cloud saves with player accounts
  • When to ask players to sign up
  • A brief for a save system
  • Common save system mistakes

Keep reading

More in Game design
Editorial ink illustration of a toy hammer striking a bell on a spring, the impact spark in ember orange
Game designNovember 22, 2026

Game Feel: How to Make Your Game Feel Juicy

Juice is the layer of feedback that makes a tap feel like a punch. Here are the techniques, the timings that work, and how to keep it from drowning the game.

7 min read
Editorial ink illustration of a hand-drawn level map pinned to a desk, the goal flag in ember orange
Game designNovember 22, 2026

Level Design Basics for Your First Game

Good levels teach one idea, test it, then twist it. Here is a repeatable method for designing levels that pace well, read clearly and never feel unfair.

6 min read

Read less. Ship more.

Everything in this post is one prompt away. Describe your app and watch it build.

Start building

Apps, games, backends and publishing from one conversation.

Product

  • Features
  • Use cases
  • Pricing
  • Changelog

Resources

  • Blog
  • Docs
  • Support
  • Status
  • Security

Contact

  • w@startbase.ai
  • X / Twitter
  • LinkedIn
  • Instagram

Legal

  • Terms
  • Privacy

© 2026 Startbase. All rights reserved.