← Back to Blog
Save Systems for Browser Games: localStorage, IndexedDB, and Cloud Saves
October 9, 2026 · FarmHeart
Nothing kills player retention faster than lost progress. A save system is the difference between a toy and a game.
localStorage (Simple Saves)
Best for: games with small save data (scores, settings, level progress, inventory under 100 items).
- Storage limit: 5–10 MB per domain (varies by browser)
- API is dead simple:
localStorage.setItem("save", JSON.stringify(data))
- Synchronous (blocks the main thread) — fine for small saves, bad for large ones
- Persists until the user clears browser data
IndexedDB (Large Saves)
Best for: games with complex state, large inventories, procedurally generated worlds, or replay data.
- Storage limit: effectively unlimited (browser asks user for permission above ~50 MB)
- Asynchronous — won’t freeze your game during save/load
- Supports structured data, binary blobs, and indexing for fast queries
- More complex API — use a wrapper library like Dexie.js or idb
Cloud Saves
For cross-device play. Options:
- Firebase Realtime DB: free tier handles thousands of players. Real-time sync between devices
- Supabase: open-source Firebase alternative. Postgres-backed, good free tier
- Custom API + Cloudflare KV: lightweight, fast, cheap. Good for simple key-value save data
Cloud saves require user accounts (email, Google sign-in, or anonymous accounts with upgrade path).
Auto-Save Best Practices
- Save after every significant action (level complete, item acquired, checkpoint reached)
- Debounce rapid saves: don’t save on every frame. Save at most once every 5–30 seconds during active play
- Show a save indicator: a brief icon so players know their progress is safe
- Keep multiple save slots: at minimum, keep the current save and one backup. Corrupted saves happen
- Version your save format: include a version number so you can migrate old saves when the game updates
Start with localStorage. It takes 5 minutes to implement and handles 90% of browser games. Only move to IndexedDB or cloud saves when you actually need the extra features.