Skip to main content

Frontend engineering · Browser

Local Storage

Also called: localStorage, sessionStorage, Cookies, Browser storage

A small bit of local storage the browser provides. It can hold a little data that's still there after you close the page and open it again.

In detail

localStorage is like a small drawer the browser gives each website. You can keep small things there like theme preferences, drafts, and recent searches, and they stay even after the browser is closed. It can only store strings, so objects have to be converted to JSON first. The space is usually just a few MB, and it only belongs to the current browser. On a different computer, it's not there.

Similar options: sessionStorage is cleared when the tab closes. Cookies are even smaller and get sent to the server automatically with every request, so they're often used for login state.

Two things to watch: first, any JavaScript on the page can read localStorage, so don't store passwords or other sensitive info there. Second, in SSR projects, the server has no localStorage, and reading it directly causes an error, so make sure that code only runs in the browser.

Developer info
Term ID
eng-local-storage
DOM selectors
No DOM cues. This concept isn't detected directly on a page.
Priority
1 · when several match at the same level, the higher priority wins
Version
v1 · updated Sep 29, 2026