Cosmovex Tools

Need an ER diagram of a SQLite database? Open the .db file or paste .schema output

SQLite ER diagram with Schema Diff Studio

A small music library database in sqlite3 .schema form is loaded with no Before, so the page opens on its ER diagram: artists, albums, tracks, playlists and the playlist_tracks join table, with each REFERENCES drawn as a relationship. Open your own .sqlite or .db file into the After editor instead and the same diagram is drawn from its schema; the rows are never read.

  1. Press Open file above the After editor and choose your .sqlite, .sqlite3 or .db file (or Clear After and paste the output of sqlite3 app.db .schema). Leave Before empty.
  2. The schema is executed in SQLite in your tab and the page opens on the Diagram tab, with each table, its columns and primary key, and each foreign key drawn as a line.
  3. Drag the tables into an order that reads well (desktop); the layout is saved with the project in this browser.
  4. Exporting is Pro ($29 once): PNG or SVG, a Mermaid erDiagram for a README, or a Markdown data dictionary of every column with its type, default and constraints. Viewing the diagram stays free.
sqlite er diagram online sqlite database to er diagramsqlite er diagram generatorsqlite db to er diagramsqlite schema diagramview sqlite schema online
Open Schema Diff Studio Free · Pro $29 one-time · no account

What to know

A SQLite database is one file, and its schema is stored inside it as the original CREATE statements in the sqlite_schema table. Opening the file here reads those statements with sql.js, SQLite compiled to WebAssembly, and nothing else: no rows are queried, and the file never leaves your device. That makes it practical for the database inside a mobile app, a desktop app's local store or a test fixture, where you have the file but no diagram.

Relationships are drawn only for declared foreign keys. Many SQLite schemas have columns like artist_id with no REFERENCES clause, because foreign keys are optional and enforcement is off by default (it needs PRAGMA foreign_keys = ON per connection). Such columns appear in their table but without a line; the diagram is a picture of the constraints that exist, which is also a quick way to spot the ones that do not.

SQLite specifics are kept: INTEGER PRIMARY KEY columns (aliases for the rowid), WITHOUT ROWID tables like playlist_tracks, composite primary keys, CHECK constraints and declared types, even loose ones such as a column with no type at all. With Pro, Mermaid's erDiagram export carries tables, columns, keys and relationships, and the Markdown data dictionary carries the defaults and constraints.

When you change the schema later, put the current one in Before and the new one in After: the page then gives you the migration too, with ALTER TABLE ADD COLUMN where SQLite allows it and the documented table rebuild where it does not.

Updated · Cosmovex

Questions

How do I create an ER diagram from a SQLite database file?

Open the .db or .sqlite file in the After editor, or paste the output of sqlite3 your.db .schema, and press Compare with Before empty. The diagram is drawn from the schema stored in the file; no rows are read.

Is my database file uploaded?

No. The file is read in your browser by SQLite compiled to WebAssembly, and only its schema is used. Projects, including the schema text and the diagram layout, are saved in this browser's storage.

Why are some relationships missing from the diagram?

Only declared foreign keys (a REFERENCES clause or a FOREIGN KEY table constraint) are drawn. A column named like artist_id without REFERENCES is just a column to SQLite, so it has no line. Adding the constraint to an existing SQLite table needs a table rebuild.

Can I open the database from a mobile app?

Yes, any SQLite file opens, including a database copied off an Android emulator or out of an app's container. Relationships appear where the app declared foreign keys in its schema; an ORM that only tracks relations in code leaves plain id columns without lines.

Can I export to Mermaid or an image?

Yes, with Pro ($29 once): PNG, SVG, a Mermaid erDiagram (.mmd) and a Markdown data dictionary. Opening the file and viewing, zooming and arranging the diagram are free.

The free plan covers everything on this page. Schema Diff Studio Pro ($29, paid once) is described on the Schema Diff Studio page.