Home › Developer Tools › SQLite Viewer

SQLite Viewer

Open a SQLite database file to see its tables with row counts, browse the data page by page, read the schema and run your own SQL queries. Results export to CSV, and the file never leaves your device.

Advertisement

How to use the SQLite Viewer

  1. Open your database: drop the .db or .sqlite file onto the box or click it to choose a file. No file handy? Press “View sample database”.
  2. Check the file header card for the page size, encoding and the SQLite version that last wrote the file.
  3. Pick a table on the left to browse its rows. Use the arrows to page through and change how many rows you see per page.
  4. Open Schema to see the columns, types and CREATE statements, or Run SQL to type a query and press Run Query.
  5. Export a query result or a whole table as CSV, or download the database after making changes with SQL.

The SQLite file header explained

Every SQLite 3 database starts with a 100-byte header. The viewer reads it directly from the file before loading the SQLite engine, so you can identify a file even offline. All multi-byte values are big-endian.

OffsetSizeFieldTypical value
016Magic string SQLite format 3\0Always the same
162Page size in bytes (1 means 65,536)4096
18 / 191 + 1Write / read format version: 1 = rollback journal, 2 = WAL1 or 2
284Database size in pagesfile size ÷ page size
364Number of free-list (unused) pages0 after VACUUM
444Schema format number4
564Text encoding: 1 UTF-8, 2 UTF-16le, 3 UTF-16be1
604User version (PRAGMA user_version), often an app's schema version0
684Application ID (PRAGMA application_id)0, or e.g. GeoPackage
964Version of SQLite that last wrote the file3045001 = 3.45.1

Handy SQLite queries

TaskQuery
List tablesSELECT name FROM sqlite_master WHERE type = 'table';
Columns of a tablePRAGMA table_info(books);
First 100 rowsSELECT * FROM books LIMIT 100;
Count rows per valueSELECT year, COUNT(*) FROM books GROUP BY year ORDER BY 2 DESC;
Join two tablesSELECT b.title, a.name FROM books b JOIN authors a ON a.id = b.author_id;
Find duplicatesSELECT email, COUNT(*) FROM users GROUP BY email HAVING COUNT(*) > 1;
Database size checkPRAGMA page_count; PRAGMA page_size;
Integrity checkPRAGMA integrity_check;

Where you will find SQLite files

SQLite is the most widely deployed database in the world. You will come across it in browser profiles (history, cookies and bookmarks), Android and iOS app data, desktop apps such as Lightroom catalogues, messaging and note-taking apps, GIS formats like GeoPackage (.gpkg) and MBTiles map tiles, and countless embedded devices. Many of these use extensions other than .db, but they all start with the same “SQLite format 3” header that this viewer checks.

Frequently asked questions

How do I open a .db file?

Most .db files from apps are SQLite databases. Drop the file onto this page and its tables appear in a few seconds. If the tool says the header is missing, the file is a different format; the message tells you what it looks like instead.

Is my database uploaded to a server?

No. The file is read into your browser's memory and opened with sql.js, a WebAssembly build of SQLite. Only the sql.js library itself is downloaded from a CDN; your data never leaves your device.

Can I edit the database?

Yes. Run INSERT, UPDATE, DELETE or CREATE statements in the Run SQL tab. Changes are made to an in-memory copy; press Download database to save the edited file. Your original file is never modified.

Why do I see a -wal or -journal error?

SQLite keeps temporary companion files next to a database, such as app.db-wal or app.db-journal. They are not databases by themselves. Open the main file (app.db). If the app is still running, close it first so recent changes are written into the main file.

How large a SQLite file can I open?

Files of a few hundred megabytes usually work on a desktop computer; the limit depends on your device's memory because the whole file is loaded into the browser. Files over 1 GB are refused to keep the tab responsive.

Can it open encrypted databases?

No. Databases encrypted with SQLCipher or the SQLite Encryption Extension, such as some messenger backups, cannot be read without the key. They usually fail with a “file is not a database” error.

What does the “Written by SQLite” version mean?

Bytes 96–99 of every SQLite file store the version number of the SQLite library that last modified it, for example 3045001 for version 3.45.1. It helps when debugging compatibility between apps.

Related tools