SQLite Diff

Compare two SQLite schemas in your browser, or compare two .db files row by row. Schema comparison is free and needs no account.

Compare two SQLite schemas

Runs entirely in your browser — nothing is uploaded
Original
+ Modified
Paste SQL into both panes to see the difference instantly.

Two kinds of SQLite comparison

“Diff two SQLite databases” usually means one of two quite different things, and it is worth knowing which you need.

Schema comparison answers “is the structure the same?” — tables, columns, types, indexes, triggers and views. This is the common case when an app works on one device and fails on another, or when a migration may not have run. Export the DDL from each database and compare the text using the tool above.

Data comparison answers “did the rows change?” That needs both database files to be read and their tables walked row by row. Our database comparison feature does this and reports added, removed and modified rows per table.

Getting the schema out of a .db file

The sqlite3 shell is the quickest route. Open each database and dump its structure:

sqlite3 before.db .schema > before.sql
sqlite3 after.db  .schema > after.sql

Then paste the contents of each file into the two panes above. If the two schemas were generated by different tools, turn on “Ignore whitespace” so formatting differences do not drown out the real structural changes.

Where SQLite schemas drift in practice

On mobile especially, SQLite schema drift is a common and hard-to-diagnose class of bug. A Room or Core Data migration that worked on a fresh install behaves differently on a device that upgraded through three earlier versions. Users who skipped a release end up on a schema path nobody tested. Comparing the schema from an affected device against a clean install is usually the fastest way to see what actually differs.

Frequently asked questions

How do I diff two SQLite databases?+

There are two approaches. To compare schemas, run ".schema" in the sqlite3 shell against each database and paste the two outputs into the tool on this page — that is free and needs no account. To compare the actual rows inside two .db files, use the database comparison feature, which reads both files table by table.

How do I export a SQLite schema to compare it?+

Open the database with the sqlite3 command-line shell and run .schema, or run "SELECT sql FROM sqlite_master WHERE type = 'table';". Both produce the DDL text you can paste into the comparison panes.

What is the difference between this and the sqldiff utility?+

sqldiff is SQLite's own command-line tool. It reads two .db files directly and prints the SQL statements that would turn the first into the second. It is excellent, and if you already have it installed it is often the fastest option. This page is for when you want to compare schema text in a browser without installing anything, or want a visual side-by-side view.

Can I compare a SQLite database against a MySQL or Postgres one?+

Only at the text level. If you export DDL from each and paste both in, the comparison will show the textual differences, but dialect differences in type names and syntax will show up as changes even where the intent matches.