The Limits of Local Storage: Capacity, Deletion Timing, and Safety Explained
The Limits of Local Storage: Capacity, Deletion Timing, and Safety Explained LocalStorage is commonly used in modern web apps to store user settings and small pieces of data directly on the device. But many developers (and users) are surprised to learn that localStorage has clear limitations, strict capacity limits, and unexpected deletion behaviors—especially on iPhone. This article explains localStorage’s storage limits, why data sometimes disappears, how browsers decide what to delete, and how to use localStorage safely. What Is Local Storage? (Quick Refresher) localStorage is a simple browser-based storage system used to save small amounts of data on the user’s device. It’s commonly used for: Saving UI preferences Keeping temporary flags Preserving PWA setup states Unlike cookies, localStorage does not expire automatically. But that does not mean it stays forever—especially on iOS. How Much Can You Store? Actual Capacity Limits The biggest limitation: localStorage is very small. Most environments allow only around 5MB. Browser / Platform Approx. Capacity iOS Safari ~5MB Android Chrome 5–10MB iOS PWA (standalone) ~5MB Desktop Browsers 10MB around localStorage is meant for very small configuration data—not large JSON files, images, or app datasets. If you exceed the limit, the browser throws a QuotaExceededError and the save […]