Developer tools

SQLite Viewer

Open a .sqlite, .db or .sqlite3 file to browse tables, read schemas, run SQL and draw the foreign-key diagram. The file is loaded into the page's memory and the original is never changed.

Database file

Up to 512.0 MB, held in memory while open

Drop a SQLite database or click to choose

SQLite 3 files, including those with the .db extension

SQLite Viewer

Operator: Abdulla Al Fahad. How tools are built and checked

A file with a .db extension on a test phone, in a browser profile or inside a vendor's support bundle is usually a SQLite database, and reading it normally means installing a database client you will use once. This page opens it in the tab instead. Drop a .db, .sqlite or .sqlite3 file of up to 512 MB and the tables, views, indexes and triggers are listed with their row counts, and nothing is uploaded.

Load example opens a small invented shop database, handy for trying the browse filters, a three-table join, a BLOB picture and the foreign-key diagram before you drop in a file of your own.

Key features

  • Lists tables, views, indexes and triggers from sqlite_master, with the column list, primary key, NOT NULL and default of every table
  • Browses 100 rows per page with a sort on any column and a filter that searches one column or all of them
  • Runs your own SQL statement by statement; read-only by default, with an edit mode that works on an in-memory copy
  • Previews BLOBs that start with PNG, JPEG, GIF, WebP or BMP signatures and shows a hex dump for everything else
  • Draws an entity-relationship diagram from PRAGMA foreign_key_list and saves it as SVG
  • Exports a result to CSV, JSON or XLSX, up to 100,000 rows

How the database is opened and what stays read-only

A SQLite file begins with the 16 bytes SQLite format 3 followed by a NUL. The page checks that header before loading anything, so a renamed Excel file or an encrypted SQLCipher database is refused with that reason instead of a vague error. The engine is sql.js 1.15.2, SQLite compiled to WebAssembly; the 686 KB module is served from this site's own /sqljs/ folder.

The whole file is copied into the engine's memory, which is why the limit is 512 MB. Integers that do not fit in a JavaScript number, anything beyond 2^53, come back as text so no digit is rounded. BLOB columns appear as BLOB 980 B in the grid; click one to see the picture or the first 512 bytes in hex.

A result set holds at most 100,000 rows or 128 MB of cell data, whichever comes first, and says so when it stops. Statements in a script run one after another and the last one that returns rows is the one shown.

How it works

Read-only mode has three layers. Each statement is split into tokens with a small SQLite tokenizer, so a quoted name such as PRAGMA "query_only" = 0 is recognised for what it is, and only SELECT, WITH, VALUES, EXPLAIN and a short list of reporting PRAGMAs such as table_info or integrity_check are allowed. The script then runs against a scratch copy of the database that is thrown away afterwards, and that copy also has PRAGMA query_only = ON. Whatever a script does, the database you are looking at is not the one it ran on.

Edit mode runs your statements on the open database itself, in the page's memory. Download modified copy writes it as a new file named after the original with -edited added. Schema changes refresh the table list and the diagram. Switching back to read-only gives queries a fresh copy of the edited state.

When this helps

  • A mobile developer pulls an app's database off a test phone to see why a sync bug report mentions missing contacts. The filter on the email column set to "is NULL" shows the 37 rows that never received a value, and one click exports them for the ticket.
  • An analyst receives a 140 MB browser history file and sorts the moz_places-style table by a visit count column, then exports the top 5,000 rows to XLSX for a pivot table.
  • A support engineer is told that an audit trigger "was never installed" on a customer's database. The Schema tab shows the stored CREATE TRIGGER text, or the lack of it, without anyone running SQL against production data.
  • A QA engineer reproduces a bug with a query that returns 12 stuck jobs, exports them as XLSX and attaches the file to the issue next to the SQL that produced it.

Opening a file

  1. Drop a database file, or choose Load example.
  2. Pick a table on the Browse tab, click a column header to sort, and type in the filter to narrow the rows.
  3. Open the SQL tab, write a query and press Run or Ctrl/Cmd+Enter.
  4. Click any cell that reads BLOB or a long text to see it in full.
  5. Export the result as CSV, JSON or XLSX, or open ER diagram to save the schema picture.

Example

On the SQL tab with the example database loaded

SELECT c.name, o.id AS order_id, o.status, t.total
FROM orders o
JOIN customers c ON c.id = o.customer_id
JOIN order_totals t ON t.order_id = o.id
ORDER BY t.total DESC;

Result (4 rows)

Tomas Ruiz   3  paid     78.5
Mara Lindqvist 1  shipped  38.9
Mara Lindqvist 2  new      32
Aiko Tanaka  4  new      29.7

Limits

Only SQLite 3 files open. SQLCipher and other encrypted variants look like random bytes and fail the header check.

A WAL-mode database copied without its -wal file may be missing the most recent writes, because only the main file is read.

Cancel stops a long query by closing the database, so reload the file afterwards, and unsaved edit-mode changes are lost.

  • The filter treats % and _ literally, so searching for 50% finds the text 50% and not everything that starts with 50.

Common errors and how to fix them

"Read-only mode does not allow DELETE statements" (or INSERT, UPDATE, PRAGMA ...)
The statement could change the database, so read-only mode refused it before it ran. Tick Allow changes (edit mode) if you mean to edit the in-memory copy. PRAGMA table_info(name) and the other reporting pragmas are allowed; PRAGMAs that set a value are not.
"This file does not start with the SQLite header"
The file is not an SQLite 3 database or it is encrypted. A .db extension is also used by other programs, so check where the file came from.

What the ER diagram shows and leaves out

Arrows come only from declared FOREIGN KEY constraints. The example has three: order_items to products, order_items to orders, and orders to customers. A column such as customer_id in a database that never declared the constraint is not guessed at, so an older schema may look disconnected even when the application treats it as linked.

Up to 80 tables are drawn. The picture is an SVG shown inside an image element, so nothing in a table name can run as script.

Exports and spreadsheet safety

A cell whose text starts with =, +, - or @ is defused on export (it gets a leading apostrophe) so opening the CSV or XLSX in a spreadsheet cannot run it as a formula. BLOB cells are written as x'hex' for the first 64 bytes in CSV and XLSX, and as a base64 object in JSON. XLSX cuts a cell at 32,767 characters and a sheet at 1,048,575 rows and tells you when it does.

Frequently asked questions

Can I save my edits back to the original file?

No. A browser tab cannot overwrite a file it was handed. Download modified copy gives you a new .sqlite file; replace the original yourself once you have checked it.

How does this differ from SQL on CSV here?

That tool loads a CSV into a temporary table so you can query it. This one opens an existing database with its own schema, indexes and triggers, and does not import anything.