Skip to content
MySafeToolbox

SQL Query on CSV

Free tool to run SQL queries on CSV files with SQLite in your browser. Join several CSVs, GROUP BY, export results as CSV, JSON or a .sqlite file. Private.

  • No upload — 100% private
  • Instant, on your device
  • Free, no sign-up
  • Works offline once loaded

How it works

How to use SQL Query on CSV

  1. Drop one or more CSV files (each becomes a table named after the file), or try the sample tables.

  2. Check the schema panel for table names, column types and row counts — numbers are detected as INTEGER or REAL unless you keep everything as TEXT.

  3. Write a SQLite query or pick a generated sample, then press Run or Ctrl/⌘ + Enter.

  4. Page through the results and download them as CSV or JSON, or download the whole database as a .sqlite file.

Why use it

Why use our SQL Query on CSV tool

Real SQLite in your browser

Queries run on SQLite compiled to WebAssembly, so joins, GROUP BY, window functions, CTEs and date functions work exactly as in SQLite.

Several CSVs, several tables

Every file becomes its own table with a clean name, so you can JOIN exports from different systems in one query.

Type detection

Columns of whole numbers become INTEGER and decimals become REAL so sorting and maths work; codes with leading zeros stay TEXT. One switch keeps every column as TEXT.

Helpful editor

Sample queries built from your schema, query history for the session, Ctrl/⌘ + Enter to run, and exact SQLite error messages.

Export anything

Download results as CSV or JSON (every row, not just the visible page) or save all tables as a .sqlite database for DB Browser, DBeaver or Python.

Safe with big files

SQLite runs in a background worker; a slow query can be cancelled at any time and stops automatically after 60 seconds. Your data never leaves the device.

FAQ

Frequently asked questions

How do I run SQL on a CSV file?

Drop the CSV here. It is loaded into an in-browser SQLite database as a table named after the file (orders.csv becomes orders). Type a query such as SELECT * FROM orders LIMIT 100 and press Ctrl/⌘ + Enter.

How are table and column names chosen?

Names come from the file name and header row with spaces and symbols replaced by underscores, so “Sales 2024.csv” becomes Sales_2024 and “First Name” becomes First_Name. Duplicate names get _2, _3 and so on. The schema panel shows every name.

Can I join two CSV files?

Yes. Add as many files as you like; each becomes a table. Use a normal JOIN, for example SELECT * FROM orders JOIN customers USING (customer).

Why is my column TEXT instead of a number?

A column is numeric only if every non-empty value is a number. One stray value such as “n/a”, or codes with leading zeros like 00501, keep it TEXT so nothing is lost. You can still CAST(column AS REAL) in a query.

Is there a size limit?

Files up to 100 MB each can be loaded, depending on your device’s memory. The results table shows up to 10,000 rows, but CSV and JSON downloads include every row.

Are my files uploaded to a server?

No. The SQLite engine is downloaded once and runs entirely in your browser. Your CSV files and query results never leave your device.