ToolsBlog

How to Open a .db File

Try it free:SQLite ViewerQuery CSV with SQL

Table of Contents

  • Step 1: check that it is a SQLite database
  • Option 1: open it in your browser
  • Option 2: the sqlite3 command-line shell
  • Option 3: DB Browser for SQLite
  • Option 4: Python
  • Example: reading your own Chrome history
  • When a .db file will not open
  • Summary

A file ending in .db is a database file, but the extension does not say which kind. Most of the time it is SQLite: a complete database with tables, indexes and views stored in a single file. Phones, browsers, desktop apps and Python projects all use it because it needs no server.

This guide shows how to check what your file is, four ways to open a SQLite database, and why some .db files will not open anywhere.

Step 1: check that it is a SQLite database #

Every SQLite 3 database starts with the same 16 bytes: the text SQLite format 3 followed by a zero byte. On macOS or Linux, the file command reads that header for you:

file app.db
# app.db: SQLite 3.x database, last written using SQLite version 3053004, ...

The extension can be anything: .db, .sqlite, .sqlite3, .db3, .s3db, or none at all. Chrome's browsing history, for example, is a SQLite file named just History.

If the header is something else, the file is not SQLite and no SQLite tool will open it. Two common lookalikes:

  • Thumbs.db is a Windows thumbnail cache, not a database you can browse. It is safe to ignore.
  • .db files from encrypted apps (for example databases protected with SQLCipher) look like random bytes. They can only be opened with the app's key.

Option 1: open it in your browser #

The quickest way to look inside is the SQLite Viewer. Drop the file on the page and you get:

  • every table and view with its row count,
  • the schema, with each CREATE TABLE statement,
  • search and sorting on any table,
  • a read-only SQL box,
  • CSV or JSON export of a table or a query result.

The database is opened by SQLite compiled to WebAssembly inside the browser tab, so the file is not uploaded. If the file is not SQLite, the viewer tells you what it found instead: a ZIP archive, a -wal file, an encrypted database, and so on. There is a sample database on the page if you want to try it first.

Option 2: the sqlite3 command-line shell #

sqlite3 is preinstalled on macOS and most Linux distributions; on Windows, download the command-line tools from sqlite.org.

sqlite3 app.db

Inside the shell:

.tables                      -- list tables
.schema orders               -- show the CREATE statement for one table
SELECT * FROM orders LIMIT 10;

To save a table as CSV:

.headers on
.mode csv
.once orders.csv
SELECT * FROM orders;

Option 3: DB Browser for SQLite #

DB Browser for SQLite is a free desktop app for Windows, macOS and Linux. It is the right choice when you need to edit data or change the schema, which browser viewers (including ours) deliberately do not do.

Option 4: Python #

Python ships with the sqlite3 module, so nothing needs installing:

import sqlite3

con = sqlite3.connect("app.db")
tables = con.execute("SELECT name FROM sqlite_master WHERE type = 'table'").fetchall()
print(tables)

With pandas installed, pandas.read_sql("SELECT * FROM orders", con) loads a table into a DataFrame.

Example: reading your own Chrome history #

Chrome keeps your browsing history in a SQLite file called History (no extension):

  • macOS: ~/Library/Application Support/Google/Chrome/Default/History
  • Windows: %LOCALAPPDATA%\Google\Chrome\User Data\Default\History
  • Linux: ~/.config/google-chrome/Default/History

Chrome locks the file while it runs, so copy it somewhere else first and open the copy. The urls table holds one row per page. Its timestamps count microseconds since 1601, so convert them in SQL:

SELECT url, title,
       datetime(last_visit_time / 1000000 - 11644473600, 'unixepoch') AS last_visit
FROM urls
ORDER BY last_visit_time DESC
LIMIT 20;

Firefox stores the same kind of data in places.sqlite in your profile folder. As with any database, only open files that are yours or that you have permission to inspect.

When a .db file will not open #

What you see What it means What to do
File has no SQLite header and looks random The database is encrypted It can only be read with the owning app's key
File name ends in -wal, -shm or -journal A SQLite side file, not the database Open the main .db file next to it
"Database disk image is malformed" The copy is incomplete or was taken mid-write Close the app, then copy the file again
Recent data is missing Changes are still in the -wal file Close the app so SQLite merges them, then copy again
The file is 0 bytes The app created a placeholder Copy it again after the app has saved data
Text such as CREATE TABLE A SQL dump, not a database file Run it with sqlite3 new.db < dump.sql, or open it in the SQLite Viewer, which runs SQLite dumps

Summary #

  1. Check the header: SQLite files start with SQLite format 3.
  2. To look inside quickly, open it in the SQLite Viewer in your browser.
  3. To script or automate, use the sqlite3 shell or Python.
  4. To edit, use DB Browser for SQLite.

Try the tools from this post

Free and private: your files stay in your browser.

  • SQLite ViewerOpen SQLite .db and .sqlite files, browse tables with row counts, run read-only SQL, and export the results.
  • Query CSV with SQLRun SQL queries directly on CSV files.

Related posts

CSV AI: Querying CSV files with AI and natural language

We are proud to introduce a new, free tool where you can query your CSV with AI.

2024-05-01

Introducing ChatDB Dashboards

We are proud to announce charts and MySQL support!

2024-01-28

Posthog <> ChatDB

Learn how to analyze your product using Posthog and ChatDB together.

2023-12-11

ChatDB

Free, browser-side data tools. No uploads, no accounts.

Data tools

Reader

  • Parquet Reader and Viewer
  • Excel Viewer and Editor
  • SQLite Viewer
  • Gzip CSV Reader
  • CSV Size Analyzer
  • Parquet Schema Reader
  • Parquet Metadata Reader
  • Data Profiler
  • Image Measure
  • Shapefile Viewer
  • GeoJSON Viewer

Editor

  • CSV Viewer and Editor
  • Excel Viewer and Editor
  • Online Excel Editor
  • CSV Splitter
  • Markdown Editor
  • Image Cropper
  • SVG Editor
  • Screenshot Background Creator
  • Document Scanner
  • Audio Clipper
  • Video Trim & Crop Tool

Converter

  • CSV to Gzip Converter
  • CSV to Parquet Converter
  • Excel to CSV Converter
  • Parquet to CSV Converter
  • JSON to Parquet Converter
  • Parquet to JSON Converter
  • CSV Decompressor
  • CSV to JSON Converter
  • CSV to Markdown Table
  • Image Converter
  • KML to GeoJSON Converter
  • GPX to GeoJSON Converter
  • GeoJSON to KML Converter
  • Shapefile to GeoJSON Converter

Formatter

  • CSV Encoder
  • SQL Formatter
  • JSON Formatter
  • XML Formatter
  • YAML Formatter
  • Dataset README Generator
  • URL Encoder & Decoder
  • Regex Tester

Compressor

  • CSV Compressor
  • CSV to Gzip Converter
  • CSV Decompressor
  • Image Compressor

AI

  • Parquet AI
  • CSV AI
  • Color Palette Generator
  • Extract Image Colors

GIS

  • Lat/Lng Point Finder
  • KML to GeoJSON Converter
  • GPX to GeoJSON Converter
  • GeoJSON to KML Converter
  • Shapefile to GeoJSON Converter
  • Shapefile Viewer
  • GeoJSON Viewer

Image tools

Convert To

  • Convert to JPEG
  • Convert to PNG
  • Convert to WEBP
  • Convert to GIF
  • Convert to BMP
  • Convert to TIFF
  • Convert to ICO
  • Convert to AVIF
  • Convert to FF
  • Convert to HDR
  • Convert to EXR
  • Convert to QOI
  • Convert to TGA
  • Convert to PNM

Edit

  • Image Cropper
  • SVG Editor
  • Screenshot Background Creator
  • Document Scanner

Compress

  • Compress JPG
  • Compress JPEG
  • Compress PNG
  • Compress WEBP
  • Compress GIF

Company

  • All tools
  • Blog
  • Privacy Policy
  • Terms of Service

© 2026 ChatDB. All rights reserved.

v2.4.1