Explain it in 60 seconds
localStorage, sessionStorage and cookies
Frontend Engineering · Async JavaScript and the Browser · Beginner
What are the differences between localStorage, sessionStorage and cookies?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- localStorage: persists, per origin, ~5MB, sync API.
- sessionStorage: per tab, cleared on close.
- Cookies: sent with requests, small, expiry, HttpOnly option.
- Don't store secrets in web storage (XSS).
- Strings only.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.