Esta página ainda não está disponível em Português, por isso está a ler a versão em inglês.

Storage quota, persistence and eviction in PWAs

How much you can store, and how to keep it.

Cache e offline Intermediário 2 min de leitura Revisado em 27 de nov. de 2026

Browsers give each site (each origin) a storage quota, shared by IndexedDB, the Cache API, OPFS and service worker registrations. Here is how it works in 2026.

How much?

BrowserApproximate quota per origin
Chrome and EdgeUp to about 60% of total disk size
FirefoxUp to about 10% of disk (or 10 GiB) in best-effort mode; up to 50% (8 TiB cap) when persistent
SafariAround 60% of disk for browser apps and Home Screen web apps; less for embedded views

These change between versions, so always ask the browser rather than assuming.

const { usage, quota } = await navigator.storage.estimate();
console.log(`Using ${(usage / 1e6).toFixed(1)} MB of ${(quota / 1e9).toFixed(1)} GB`);

Try it on your own device with the storage inspector.

Best-effort vs persistent

By default, storage is best-effort: when the device runs low on space, the browser may delete it, least recently used origins first. You can ask for persistent storage, which is only cleared by the user:

if (navigator.storage?.persist) {
  const persisted = await navigator.storage.persisted() || await navigator.storage.persist();
  console.log(persisted ? 'Storage is persistent' : 'Storage may be cleared');
}
  • Chrome and Edge grant it automatically when the site is installed, bookmarked, has notification permission or is used a lot. No prompt.
  • Firefox asks the user.
  • Safari (17 and later) decides from how the site is used, without a prompt; Home Screen web apps are the most likely to get it.

Safari's seven-day rule

Safari's Intelligent Tracking Prevention deletes script-writable storage (IndexedDB, Cache API, localStorage, service worker registrations) for sites the user has not interacted with in seven days of browser use. Home Screen web apps are exempt: their storage is separate and is not subject to this rule. This is one more reason to encourage installation on iOS.

Handling quota errors

Writes can fail with a QuotaExceededError. Catch it, clear old caches, and tell the user if needed:

try {
  await cache.put(request, response);
} catch (err) {
  if (err.name === 'QuotaExceededError') await trimCaches();
}

Good habits

  • Cap runtime caches by count and age.
  • Do not cache opaque cross-origin responses unless necessary (they are padded to several MB each in Chrome's quota accounting).
  • Store large files in OPFS rather than as base64 strings.
  • Offer a "Clear offline data" button in your settings.

Compatibilidade de navegadores

Compatibilidade dos navegadores com recursos de PWA
RecursoChrome / Edge desktopChrome AndroidSafari iOS / iPadOSSafari macOSFirefox desktopFirefox AndroidSamsung Internet
Persistent storage Chrome / Edge desktop: Sim Chrome Android: Sim Safari iOS / iPadOS: Sim (Safari 17+, decided by usage) Safari macOS: Sim (Safari 17+) Firefox desktop: Sim (Asks the user) Firefox Android: Sim Samsung Internet: Sim
Origin Private File System Chrome / Edge desktop: Sim Chrome Android: Sim Safari iOS / iPadOS: Sim Safari macOS: Sim Firefox desktop: Sim Firefox Android: Sim Samsung Internet: Sim
IndexedDB Chrome / Edge desktop: Sim Chrome Android: Sim Safari iOS / iPadOS: Sim Safari macOS: Sim Firefox desktop: Sim Firefox Android: Sim Samsung Internet: Sim

Ver a tabela completa