Local storage (localStorage)
Also known as: localStorage, web storage, DOM storage
localStorage is a small per-site store where web apps save data that persists across visits and browser restarts — drafts, preferences, and tokens. Unlike a session, it does not expire on its own; clearing site data is how you remove it, which can reset or sign you out of that web app.
- Persistent per-site key-value storage for web apps
- Survives restarts; cleared with site data
- Small quota — for settings and tokens, not files
How localStorage works
Modern web apps use localStorage to keep simple key-value data on your device — a theme choice, an unsaved draft, or a login token. It belongs to one site only and stays until the site or you delete it, surviving tab closes and reboots.
Each site gets a modest quota (typically a few megabytes), so localStorage is for small data, not large files. That makes it a minor part of total storage, but an important one for how a web app behaves.
localStorage vs sessionStorage
The two look the same to code but differ in lifetime: localStorage persists indefinitely, while sessionStorage clears when the tab closes. Both are wiped when you clear a site’s data.
You remove localStorage by clearing Cookies and other site data in Chrome’s Delete browsing data, or by clearing website data for a site in Safari. Doing so can log you out of, or reset, that particular web app.