What if the database powering your app never touched a server at all? No connection string, no monthly hosting bill, no network round trip. That idea has moved from novelty to practical reality, and the tools behind it are maturing fast. SQLite compiled to WebAssembly, DuckDB-WASM, and PGlite now let developers run serious query engines inside a browser tab, persisting data locally through browser storage APIs.
That shift raises a fair question: which one should you actually pick? The answer depends less on raw speed claims and more on what kind of work you’re doing. This comparison walks through how each tool works, where it fits, and the mistakes that trip people up when they first try browser databases.
Why Browser Databases Suddenly Matter
For years, client-side storage meant localStorage for a few settings or IndexedDB for structured blobs. Both work, but neither gives you SQL. Developers ended up writing filtering and aggregation logic by hand, then duplicating it on the server.
WebAssembly changed the calculus. It is a portable binary instruction format designed as a compilation target for a stack-based virtual machine, and it became a W3C Recommendation on 5 December 2019. Once real engines could compile to it, the browser stopped being a dumb terminal.
The second enabler was persistence. OPFS (Origin Private File System) is part of the WHATWG File System standard. It gives web apps a private, origin-scoped filesystem with synchronous access inside workers. That synchronous access matters: it is the basis for fast local persistence in browser databases. Before OPFS, engines had to lean on IndexedDB, the older structured-storage API, which works but adds async overhead to every write.
Put those two pieces together and you get a genuinely local database with a real query language. The interesting part is that three projects took that same foundation in three different directions.
The Three Contenders at a Glance

Each tool is a real engine compiled to WebAssembly, but they were built for different workloads.
| Tool | Engine type | Best for | Persistence path |
|---|---|---|---|
| SQLite WASM | Row-oriented OLTP | App data, offline-first apps, embedded storage | OPFS or IndexedDB |
| DuckDB-WASM | Columnar OLAP | Analytics, dashboards, Parquet and CSV queries | In-memory, with export |
| PGlite | Row-oriented OLTP (Postgres) | Postgres-compatible local apps, testing | OPFS-backed filesystem |
The row-versus-column split is the single most useful distinction in this whole comparison. SQLite and PGlite are transactional engines built to find and update individual rows quickly. DuckDB is analytical and columnar, built to scan and aggregate large datasets. Choosing a transactional engine for a dashboard, or an analytical engine for app state, is the classic mismatch.
SQLite WASM: The Boring, Reliable Workhorse
SQLite has been embedded in phones, browsers, and desktop apps for two decades. The WebAssembly build brings that same engine into the page, and the official SQLite documentation covers the WASM build and its OPFS persistence approach directly.
What makes SQLite WASM appealing is predictability. The SQL dialect is stable, the file format is famously durable, and the engine is small enough to load quickly. If you are building an offline-first app where users create records, edit them, and expect changes to survive a page reload, this is the natural default.
Where it shines
Applications that need local CRUD operations with relational structure. Think field-service apps, note-taking tools, or anything where a user works offline and syncs later. You get joins, indexes, and transactions without inventing a custom storage layer.
Where it strains
Heavy analytical queries over millions of rows. A row-oriented engine will do it, but it is not built for wide scans and aggregations. If your feature is “let users slice a big dataset,” reach for DuckDB instead.
One practical tip: run the database inside a Web Worker. Synchronous OPFS access only works in workers, and moving queries off the main thread keeps the UI responsive. A common mistake is initializing the engine on the main thread, then wondering why the page stutters during writes.
DuckDB-WASM: Analytics That Used to Need a Warehouse
DuckDB is an analytical, columnar engine, and its WebAssembly client lets you run analytical SQL directly in the browser. The official DuckDB documentation covers the WASM client, including querying Parquet and CSV files.
This is the tool that surprises people. Users can load a Parquet file, run a group-by, and get results in the time it used to take to upload the file to a server. Because the engine is columnar, it reads only the columns a query needs, which is exactly the right behavior for aggregation-heavy work.
Where it shines
Dashboards, data exploration tools, and anything that processes files client-side. If your app ingests spreadsheets and produces summaries, DuckDB-WASM removes an entire backend round trip. It also pairs well with tools that generate charts and reports, similar to how teams compare AI diagram tools pricing comparison you actually pay per seat when visualization work moves in-house.
Where it strains
Transactional workloads. Frequent small writes and row-level updates are not its strength. Persistence is also less turnkey than SQLite’s OPFS story, so many teams keep the analytical layer in memory and export results rather than treating it as a system of record.
A common mistake here is treating DuckDB-WASM like a general app database. It is a query engine. Use it to answer questions about data, not to store the data your app mutates all day.
PGlite: Postgres in a Tab
PGlite is a WebAssembly build of PostgreSQL packaged as a TypeScript and JavaScript library from the ElectricSQL community. It puts a real Postgres engine in the browser or in Node.
The pitch is compatibility. Teams already know Postgres. Extensions, SQL semantics, and the general feel of the engine carry over. For developers who have spent years writing Postgres queries, that familiarity lowers the learning curve considerably compared with adapting to a different dialect.
Where it shines
Local-first apps that want Postgres semantics, and testing environments that need a real Postgres without spinning up a container. Running the same engine locally that you run in production removes a whole class of “works on my machine” bugs.
Where it strains
Bundle size and startup time. Postgres is a bigger engine than SQLite, and that shows up in load weight. For a lightweight widget, that cost may not be worth it. For an app where Postgres compatibility is the whole point, it usually is.
The Persistence Layer Nobody Talks About Enough
Most browser database problems are actually persistence problems. The engine is fine; the storage underneath it is where things break.
OPFS is the modern answer, and it is genuinely fast inside workers. But it comes with constraints worth knowing before you build. Storage is origin-scoped, meaning data belongs to your site and is invisible to other origins. Browsers can also evict storage under pressure, so anything important needs a sync or export path. Private browsing modes often behave differently, and users who clear site data will wipe the database.
IndexedDB remains the fallback. It is widely supported and battle-tested, but the async API adds friction, and performance under heavy write loads is weaker than OPFS.
The practical rule: design for eviction from day one. Assume local data can vanish, and build a sync or backup path accordingly. Teams that skip this step discover it the hard way when a user loses a week of work.
How to Choose Without Overthinking It
Decision paralysis is common here because all three tools are genuinely good. A simple decision path cuts through it.
- Ask what the data does. If users create and edit records, you need a transactional engine. If users analyze existing datasets, you need an analytical one.
- Pick SQLite WASM for offline-first app data with relational structure and a mature persistence story.
- Pick DuckDB-WASM when the core feature is querying Parquet, CSV, or large aggregations client-side.
- Pick PGlite when Postgres compatibility or shared code with a server-side Postgres matters more than bundle size.
- Prototype with real data volumes before committing. Synthetic benchmarks mislead.
That last point deserves emphasis. Vendor benchmarks for these tools are often promotional, and comparative performance numbers shift with every release. There is no reliable, dated, independent benchmark to point to. Test with your own data and your own queries.
Cost planning follows a similar logic. Removing a backend database can cut hosting spend, but it shifts work into tooling, sync infrastructure, and developer time. Teams evaluating that trade-off often look at how social media management tools pricing comparison teams structure per-seat costs, because the same question applies: what does each additional user actually cost you? And when local-first workflows touch content operations, comparisons like content audit tools pricing comparison you really pay show how flat fees versus usage tiers change the math.
Mistakes That Show Up Again and Again
A few patterns repeat across teams trying browser databases for the first time.
Running the engine on the main thread. Queries block rendering. Move them to a worker.
Ignoring storage quotas. Browsers cap origin storage, and the limits vary. Check available space and handle quota errors gracefully instead of letting writes fail silently.
Assuming persistence is permanent. It is not. Eviction, private mode, and user clearing all remove data.
Duplicating query logic. If the browser runs SQL, resist the urge to reimplement the same filters in JavaScript for the server. Keep one source of truth.
Skipping the export path. Users should always be able to get their data out, whether as a file download or a sync. This is both a UX feature and a safety net.
Over-engineering the first version. Many teams do not need three engines. Start with one, measure, and add a second only if a genuine workload demands it.
What This Looks Like in Practice
Consider a team building an expense-tracking app. Users enter expenses offline, categorize them, and occasionally view monthly summaries. SQLite WASM handles the transactional side well: inserts, updates, and relational queries over categories. OPFS keeps data across reloads. A sync layer pushes changes when connectivity returns.
Now consider a research team building an internal dashboard. They upload CSV exports and want instant filtering and aggregation without sending sensitive files to a server. DuckDB-WASM is the better fit. The files stay in the browser, queries run locally, and only aggregate results leave the machine.
And consider a developer tooling team that wants a local Postgres for integration tests. PGlite runs the same engine as production, in Node or the browser, without container overhead. That is a different job again.
Three tools, three jobs. The comparison only gets confusing when people try to force one tool into all three roles.
Conclusion
Browser-based databases have crossed the line from demo to dependable. SQLite WASM gives you a mature, predictable transactional engine with a solid persistence story. DuckDB-WASM gives you analytical horsepower that used to require a warehouse. PGlite gives you Postgres semantics in a tab.
The right choice comes down to workload shape, not marketing. Transactional data points to SQLite or PGlite. Analytical work points to DuckDB. Persistence design, worker architecture, and an honest export path matter more than any benchmark chart.
Start with one engine, test it against real data, and let the workload decide the rest. The browser is a capable database host now. Treat it like one.
Frequently Asked Questions
Can browser databases really replace a server database?
For some apps, yes. Offline-first tools, local dashboards, and developer utilities can run entirely client-side. For multi-user apps with shared state, you still need a server or a sync layer. The browser database becomes the local cache and query engine, not the source of truth.
Is SQLite WASM the same as regular SQLite?
It is the same engine compiled to WebAssembly. The SQL dialect and file format carry over, but persistence works differently because the browser provides storage through OPFS or IndexedDB rather than a normal filesystem.
When should I choose DuckDB-WASM over SQLite?
Choose DuckDB when your primary job is analyzing data: scanning Parquet or CSV files, running aggregations, and powering dashboards. Choose SQLite when your primary job is storing and updating application records. The row-versus-column distinction is the deciding factor.
Does PGlite support Postgres extensions?
PGlite is a WebAssembly build of PostgreSQL, so it aims to carry Postgres behavior into the browser. Extension support is narrower than a full server install, so check the specific extension you need rather than assuming full parity.
What happens to local data if a user clears their browser?
It is gone. OPFS and IndexedDB storage is origin-scoped and under the browser’s control. Users clearing site data, private browsing sessions, and storage eviction under pressure can all remove it. Always build a sync or export path for anything valuable.
Are these tools fast enough for production use?
They can be, with the right architecture. Run the engine in a Web Worker, avoid main-thread queries, and test with realistic data volumes. Published comparisons vary widely and are often promotional, so your own measurements are the only reliable guide.