DEV Community

Vishwas R
Vishwas R

Posted on

1

Browser Storage Types and Their Maximum Limits

Web applications often rely on browser storage to store and manage data locally. This table compares various browser storage types—like Cookies, LocalStorage, and IndexedDB—across popular browsers such as Chrome, Firefox, and Safari. Knowing the maximum storage limits for each browser helps developers select the most suitable storage method for their needs while ensuring optimal performance and user experience.

Storage Type Description Chrome/Edge Firefox Safari Opera
Cookies Small data files sent by a website and stored on the user's device, primarily used for session management and tracking. Approximately 4 KB per cookie, with a limit of around 20 cookies per domain. Approximately 4 KB per cookie, with a limit of around 20 cookies per domain. Approximately 4 KB per cookie, with a limit of around 20 cookies per domain. Approximately 4 KB per cookie, with a limit of around 20 cookies per domain.
LocalStorage Provides persistent storage that remains even after the browser is closed; data is stored as key-value pairs in string format. Typically 10 MB per origin. (Wikipedia) Typically 10 MB per origin. (Wikipedia) Typically 5 MB per origin. (Wikipedia) Typically 5 MB per origin. (Wikipedia)
SessionStorage Similar to LocalStorage but scoped to the lifetime of the page session; data is cleared when the page session ends. Approximately 5 MB per origin. (MDN) Approximately 5 MB per origin. (MDN) Approximately 5 MB per origin. (MDN) Approximately 5 MB per origin. (MDN)
IndexedDB A low-level API for storing large amounts of structured data, including files/blobs; useful for applications requiring complex data storage. Up to 60% of the total disk size per origin. (MDN) Up to 50% of free disk space, with a maximum of 2 GB per origin. (medium.com) Up to 20% of total disk space per origin; increases to 60% if saved as a web app. (MDN) Similar to Chrome, as Opera is based on Chromium.
Cache Storage API Allows storage of request/response object pairs for efficient resource retrieval, primarily used by service workers for offline caching. Managed by the browser's storage management system; specific limits vary by browser and are typically substantial. (MDN) Managed by the browser's storage management system; specific limits vary by browser and are typically substantial. (MDN) Managed by the browser's storage management system; specific limits vary by browser and are typically substantial. (MDN) Managed by the browser's storage management system; specific limits vary by browser and are typically substantial. (MDN)
File System Access API Enables web applications to access and store files on the user's local file system with user consent; useful for applications requiring direct file manipulation. Managed by the browser's storage management system; specific limits vary by browser and are typically substantial. (MDN) Managed by the browser's storage management system; specific limits vary by browser and are typically substantial. (MDN) Managed by the browser's storage management system; specific limits vary by browser and are typically substantial. (MDN) Managed by the browser's storage management system; specific limits vary by browser and are typically substantial. (MDN)

Ultimately, knowing the storage capabilities and constraints of each browser helps developers make the best choice for their web applications. Whether you need simple key-value pairs or complex, offline-capable storage, this guide provides the foundation for effective storage management. By leveraging the right storage type for the job, you can avoid performance bottlenecks and enhance the user experience.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (1)

Collapse
 
tintin-mn77 profile image
TinTin • Edited

Great article! the browser storage comparison was useful. security and persistence are also key factors, especially for localStorage. I recently wrote about using localStorage in Js and React, would love your thoughts.
the link

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay