00

The short answer

  • SQLite Database is a database file format that stores tables, indexes, triggers and views for the SQLite engine, with no mandatory filename extension or encryption in the standard format.
  • With the official sqlite3 command-line program available on Windows or macOS, run `sqlite3 "database.sqlite"` using the actual file path. Enter `.tables` to list tables, then query a known table with SQL. Verify the path first: a nonexistent path creates a new database. On a phone, choose an app that explicitly supports SQLite database files and open a copy rather than the original. Keep the main file together with any associated -wal or -journal file when copying or moving it. If it will not open, it may be encrypted or use a format other than SQLite.
  • Treat an unfamiliar SQLite database as untrusted input and work on a copy. Malformed files may expose undiscovered parser defects. A malicious schema can also exploit custom SQL functions or virtual tables registered by the host application; for application builders, SQLite recommends protections such as disabling trusted_schema after opening a connection. Standard SQLite 3 storage is not encrypted. Successful opening or a matching header does not establish that the contents are trustworthy.
01

SQLite Database files: identify, open and convert

The current SQLite 3 format specification covers versions since SQLite 3.0.0, released on June 18, 2004. A database usually has one main file and can move between little-endian and big-endian architectures and between 32-bit and 64-bit systems. Its first 100 bytes form the database header; pages are powers of two from 512 to 65536 bytes. Common extensions include .sqlite, .sqlite3 and .db, but the header is a better identifier than the suffix.

Keep the original

In sqlite3, use `.headers on`, `.mode csv`, `.once result.csv`, then a SELECT query to export its results. CSV does not preserve the full database schema. For reconstructable SQL text, use `sqlite3 "database.sqlite" .dump > backup.sql`; import it with `sqlite3 "restored.sqlite" < backup.sql`. Check paths and protect existing output files from accidental overwriting.

02

How to open it

With the official sqlite3 command-line program available on Windows or macOS, run `sqlite3 "database.sqlite"` using the actual file path. Enter `.tables` to list tables, then query a known table with SQL. Verify the path first: a nonexistent path creates a new database. On a phone, choose an app that explicitly supports SQLite database files and open a copy rather than the original. Keep the main file together with any associated -wal or -journal file when copying or moving it. If it will not open, it may be encrypted or use a format other than SQLite.

I only want to read it

With the official sqlite3 command-line program available on Windows or macOS, run `sqlite3 "database.sqlite"` using the actual file path. Enter `.tables` to list tables, then query a known table with SQL. Verify the path first: a nonexistent path creates a new database. On a phone, choose an app that explicitly supports SQLite database files and open a copy rather than the original. Keep the main file together with any associated -wal or -journal file when copying or moving it. If it will not open, it may be encrypted or use a format other than SQLite.

I need to send it to someone

In sqlite3, use `.headers on`, `.mode csv`, `.once result.csv`, then a SELECT query to export its results. CSV does not preserve the full database schema. For reconstructable SQL text, use `sqlite3 "database.sqlite" .dump > backup.sql`; import it with `sqlite3 "restored.sqlite" < backup.sql`. Check paths and protect existing output files from accidental overwriting.

03

File safety

Treat an unfamiliar SQLite database as untrusted input and work on a copy. Malformed files may expose undiscovered parser defects. A malicious schema can also exploit custom SQL functions or virtual tables registered by the host application; for application builders, SQLite recommends protections such as disabling trusted_schema after opening a connection. Standard SQLite 3 storage is not encrypted. Successful opening or a matching header does not establish that the contents are trustworthy.

Stop if any of this looks off

An unknown sender, a name ending in two extensions, or contents that do not match the extension — check before you open it.

04

Converting it

In sqlite3, use `.headers on`, `.mode csv`, `.once result.csv`, then a SELECT query to export its results. CSV does not preserve the full database schema. For reconstructable SQL text, use `sqlite3 "database.sqlite" .dump > backup.sql`; import it with `sqlite3 "restored.sqlite" < backup.sql`. Check paths and protect existing output files from accidental overwriting.

Before you convert

Convert a copy, never the original, then compare quality, metadata, and layout against what you started with.

05

Common questions

What is a SQLite database file used for?

It stores a SQLite database, including tables, indexes, triggers and views. The database usually has one main file, with recovery files potentially present during transactions.

How do I open a SQLite file on Windows?

With the official sqlite3 command-line program available, run `sqlite3 "C:\data\database.sqlite"`, then enter `.tables`. Verify that the path exists, because sqlite3 creates a database when it does not.

How do I open a SQLite database on Mac?

With sqlite3 available, open Terminal and run `sqlite3 "/path/database.sqlite"`. Use `.tables` to list tables and SQL to query them. Check the full path before opening.

How do I open a SQLite database on a phone?

Choose an app that explicitly supports SQLite database files and follow its instructions to open a copy rather than the original. Copy or move the main file together with any associated -wal or -journal file. If it will not open, it may be encrypted or use a format other than SQLite.

What should I check when a SQLite database will not open?

Check the path and header, and retain associated journal or WAL files. The file may use another format or an encryption extension. An opening failure alone does not establish corruption.

Should I use a SQLite database or CSV to share data?

Use CSV for a selected query's rows and columns. Use SQLite when tables and database structures matter: a CSV export does not retain indexes, triggers or views.

How do I export a SQLite database to CSV?

In sqlite3, enter `.headers on`, `.mode csv`, `.once result.csv`, then your SELECT query. The file contains that query's results, rather than the complete database.

How do I back up a SQLite database as SQL?

Run `sqlite3 "database.sqlite" .dump > backup.sql`. To reconstruct a database, run `sqlite3 "restored.sqlite" < backup.sql`. Check filenames before redirecting output.

Is an unfamiliar SQLite database safe to open?

There is no blanket guarantee. Work on a copy of the database. Malformed databases may trigger parser defects, and malicious schemas may misuse host-registered SQL functions or virtual tables. For application builders, SQLite recommends disabling trusted_schema after opening a connection.

Can I delete SQLite WAL files beside a database?

Do not assume they are disposable. A WAL or rollback journal containing information needed for recovery forms part of the database state; ignoring it can leave you without a consistent database.

How can I identify a DB file as SQLite from its header?

A standard SQLite 3 database starts at offset 0 with 16 bytes consisting of `SQLite format 3` plus the trailing NUL. A .db suffix alone is insufficient, and the header does not prove safety.

Is a standard SQLite database encrypted?

No. The standard SQLite 3 file format provides no encryption. An encrypted database may rely on an extension such as SQLite Encryption Extension and require corresponding support.

06

Related formats

Sources

SQLite — Database File Format · SQLite official format specification

SQLite — Command Line Shell For SQLite · SQLite official usage documentation

SQLite — Defense Against The Dark Arts · SQLite official security documentation

SQLite, Version 3 · Library of Congress digital format description