You have a file ending in .db, .sqlite, or .sqlite3. Are they the same type? The short answer: the suffix alone tells you nothing. SQLite does not require any particular file extension. All three, plus .db3, are used as conventions for SQLite databases. But many other programs also use .db for their own non-SQLite formats. To know for certain, look at the file's internal header, not its name. This page explains the differences, how to check your file, and what to do if it is corrupted.
What the Extensions Mean
The extensions .db, .sqlite, and .sqlite3 are all common conventions for SQLite database files. None is officially required by the SQLite software itself. Many developers choose .sqlite or .sqlite3 to make the format obvious. The .db suffix is also widely used, but it is ambiguous. Windows Thumbs.db, for example, uses .db for a data format that has nothing to do with SQLite. Similarly, .db3 is another convention you might encounter. Renaming a file from one suffix to another does not change the file's format.
The Only Reliable Way to Check If a File is SQLite
Stop guessing by the extension. Check the file's header. Every genuine SQLite database starts with the same 16-byte sequence: the ASCII characters SQLite format 3 followed by a zero byte. This header is present from the moment the database is created and never changes. If the first 16 bytes are exactly that string, including the null byte, the file is an SQLite database. If not, it is something else.
Checking the Header on Your Computer
You can inspect the header using simple command-line tools or a hex editor. Here is a straightforward method using common operating system utilities:
- Open a terminal (macOS or Linux) or Command Prompt (Windows).
- Use the file command on macOS or Linux: type file yourfile.db and press Enter. If the file is SQLite, it reports something like SQLite 3.x database.
- Without the file command, use a hex dump tool like xxd or hexdump. For example, xxd -l 16 yourfile.db shows the first 16 bytes. Look for the string that is the hex representation of SQLite format 3 followed by a null byte.
- On Windows, use a free hex editor. certutil with the -hash option can dump raw bytes, but a hex editor is simpler.
If the header matches, you can be certain the file is an SQLite database, regardless of its extension.
Why Not Every .db File is SQLite
Many applications use the .db extension for their own data files. Windows uses Thumbs.db to store thumbnail caches. That file is not an SQLite database. Other programs use .db for simple key-value stores, logs, or proprietary binary formats. You cannot assume a .db file is SQLite. The same caution applies to .sqlite and .sqlite3, although those suffixes are far less common for non-SQLite files. If you encounter a .db file and need to know, the header check is the only reliable method.
What to Do If You Need to Open a .sqlite3 File
A file with the .sqlite3 suffix is almost certainly an SQLite database. Open it with any SQLite-compatible tool. The simplest approach: the official SQLite command-line shell, available for all major operating systems. Once installed, open the database by running:
sqlite3 yourfile.sqlite3This loads the database and lets you run queries. Without the command-line tool, many graphical database browsers also support .sqlite3 files. The repair tool on this site accepts .sqlite, .sqlite3 and .db files, so you can upload any of them for recovery if needed.
How to Check If a File is SQLite Without Software
You cannot install new software? You can still check the file header with a basic text editor or a hex viewer. Most text editors show the first few characters as garbled text if the file is binary. A more reliable method: use a hex dump online or a built-in system utility. On macOS and Linux, the file command is pre-installed and requires no additional software. On Windows, use PowerShell to read the first bytes:
- Open PowerShell and run: Get-Content -Path yourfile.db -Encoding Byte -TotalCount 16 | % { [char]$_ } | Join (this may need slight adjustment).
- Alternatively, use a free online hex viewer. Be cautious with sensitive data.
Remember: the first 16 bytes of every SQLite database are SQLite format 3 followed by a zero byte. If you see that, the file is SQLite.
What Happens When You Rename the Extension
Renaming a file from .db to .sqlite3, or the reverse, does not change the format. The data inside remains exactly the same. The operating system and applications may treat the file differently based on the suffix, but the underlying database content is unaffected. Rename a genuine SQLite database from .sqlite3 to .db. It is still an SQLite database. The reverse is also true: rename a non-SQLite .db file to .sqlite3, and it will still not be an SQLite database. The header is what matters.
Practical Summary Which Extension Should You Use?
Creating a new SQLite database? Any of the common suffixes will work. The choice is convention or personal preference. Here is a quick guide:
- .sqlite3 is the most explicit and leaves no doubt that the file is an SQLite version 3 database.
- .sqlite is also clear and slightly shorter.
- .db is widely used but ambiguous; it may cause confusion if others assume it is a different format.
- .db3 is less common but still a valid convention.
No matter which suffix you choose, the file behaves the same way. If you ever need to recover a corrupted SQLite file, the repair tool on this site accepts all of these extensions.