DevPrep
  • Interview Prep
  • Projects
  • Resources
  • Pricing
  • About Us
Submit Question
DevPrep
  • Pricing
  • About Us
Submit Question
← From Beginner to Expert in Fundamentals of Frontend
  • How the Web Works
  • Browsers: The Engines
  • Networking & Latency
  • HTTPS & TLS Handshake
  • CDNs & Edge Computing
  • WebSockets & WebRTC
  • RESTful Architecture
  • GraphQL Architecture
  • CORS (Cross-Origin Resource Sharing)
  • Load Balancing
  • Critical Rendering Path Deep Dive
  • DOM vs. CSSOM Construction
  • The Rendering Engine: Layout, Paint, Compositing
  • JavaScript Engine: V8 Internals
  • The Event Loop: Macro vs. Micro Tasks
  • Garbage Collection
  • Browser Storage Architecture
  • Service Workers & PWAs
  • Web Workers: Multi-Threading
← From Beginner to Expert in Fundamentals of Frontend

Browser Storage Architecture

18 min read
LocalStorageSessionStorageCookiesIndexedDBCache API

Browser Storage Options

StorageSize LimitPersistenceSent to Server?Best For
Cookies4KBConfigurable (expires/max-age)Yes (every request)Auth tokens, preferences
LocalStorage5-10MBPermanent (until cleared)NoUser preferences, theme
SessionStorage5-10MBTab lifetimeNoForm state, wizard progress
IndexedDB50MB+PermanentNoOffline data, large datasets
Cache APIVariesPermanentNoService worker, offline assets

Security Considerations

  • Never store JWTs in LocalStorage — vulnerable to XSS
  • Use httpOnly, Secure, SameSite cookies for auth
  • IndexedDB is same-origin isolated

Practice

  • JavaScript
  • DSA
  • Machine Coding
  • System Design

Resources

  • Learning Tracks
  • Articles
  • Roadmaps
  • Compare Concepts
  • Glossary
  • Developer Tools
  • All Questions

Company

  • About
  • Pricing

Legal

  • Privacy Policy
  • Terms of Service
DevPrep

© 2026 DevPrep. All rights reserved.