SQL on CSV

Drop a CSV file below — it becomes a table named data. Type a SQL query, run it, and download the result as CSV or JSON. Everything runs locally in your browser; nothing is ever uploaded.

Files never leave your device

Drop a CSV file to query, or click to browse

CSVTXT

What This Tool Does

This tool turns a CSV file into a queryable SQL table without leaving your browser. Drop your file and it's loaded into an in-memory table named data; type a SQL query — or start from one of the built-in examples — run it, and download the result as CSV or JSON.

Nothing is uploaded to make this work. A WebAssembly module loaded into your browser tab parses your file, builds the table, and runs your SQL entirely on your own device.

Tip: Not sure where to start? The moment your file loads, it auto-runs SELECT * FROM data LIMIT 100 so you can see your columns and a sample of rows immediately — edit that query in place once you know what you're looking for.

How to Use It

Drop a CSV file onto the tool. Your columns appear as a quick reference, and a preview query — SELECT * FROM data LIMIT 100 — runs automatically so you can see real rows right away. From there, edit the query box with whatever SQL you need, or click one of the example buttons (SELECT *, COUNT / GROUP BY, WHERE, ORDER BY) to start from a working query and adjust the column names. Click Run, check the result table, and download it as CSV or JSON — the download always includes every matching row, even though the on-screen table stops showing more after the first couple hundred.

Supported SQL

Queries run against a real SQL engine (GlueSQL) working entirely inside your browser, which supports a genuinely useful subset of SQL rather than the full surface of something like Postgres: SELECT with a column list, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT, the aggregates SUM, COUNT, AVG, MIN, and MAX, and common scalar functions plus CAST. A few example queries to adapt to your own columns:

SELECT * FROM data WHERE age > 30
SELECT city, SUM(amount) AS total FROM data GROUP BY city ORDER BY total DESC
SELECT name, score FROM data ORDER BY score DESC LIMIT 10
SELECT category, COUNT(*) AS n FROM data GROUP BY category HAVING COUNT(*) > 5

If you write something outside that subset — a window function, an unusual subquery, a join against a second table that doesn't exist — the query doesn't run, and the tool shows the engine's own error message rather than guessing at what you meant.

How Column Types Are Inferred

A CSV has no concept of data types, so before your query runs this tool decides, column by column, whether it should behave as a number or as text. A column becomes a real number type only if every single value in it is a plain, finite number — no letters, no currency symbols, nothing left over. Two exceptions keep values as text even when they look numeric: a value with a leading zero other than a decimal like 0.5 (so a code such as 007 isn't silently turned into 7), and a value with more than fifteen digits (so a long account or card number isn't rounded). If even one row in a column is blank or doesn't parse cleanly, the entire column stays text, so a stray typo in one row can't quietly change what SUM or AVG on that column would mean.

If you do need to treat a text column as numbers for one query — say, a column of codes you know are safe to sum — wrap it with CAST(column_name AS FLOAT) rather than relying on automatic inference.

Nothing Leaves Your Browser

Loading your CSV into a table and running your SQL against it both happen through a WebAssembly module running inside your browser tab. There's no upload step, no server holding a copy of your file, and no dependency on your internet connection once the page and its WebAssembly have loaded — your data stays on your device from drop to download.

Limits

This tool handles files up to 50 MB and 1,000,000 rows. A file past either limit is rejected up front with a clear message, before any table is built or query attempted, so you're not left waiting on a browser tab that's quietly run out of memory.

Where to Go Next

If you'd rather reshape your CSV without writing SQL, CSV to JSON and JSON to CSV handle straightforward format conversion, and CSV to Excel turns your file into a real XLSX workbook you can open directly in Excel or Google Sheets.

Frequently asked questions

What is the table called, and can I rename it?
It's always called data — every query you write should start with FROM data. There's no option to rename it, but since the table only exists for the length of your session, that fixed name is really just a convention to write your query against, not a setting you need to manage.
Which parts of SQL does this actually support?
A genuinely useful subset built on the GlueSQL engine: SELECT with column lists, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT, and the common aggregates SUM, COUNT, AVG, MIN, and MAX, plus everyday functions and CAST. It is not a full Postgres or MySQL, so more exotic syntax — window functions, subqueries in unusual positions, some join forms — may not be recognized. If you write something the engine can't run, you get its own error message back rather than a silent wrong answer, so you always know whether a query was understood.
Is my CSV file uploaded anywhere to run these queries?
No. Loading your file into a table and running your SQL against it both happen through a WebAssembly module inside your browser tab, entirely on your own device. Your file is never sent to a server, and nothing about its contents leaves your machine at any point.
Why is my numeric-looking column treated as text instead of a number?
A column only becomes a real number type if every single value in it is a plain, finite number with no leading zero (other than a decimal like 0.5) and no more than fifteen digits — protecting things like a 007-style code or a long account number from being silently reinterpreted. If even one row in that column is blank, non-numeric, or breaks one of those rules, the whole column is kept as text so nothing gets corrupted. You can still work with it as a number inside a query by wrapping it, for example CAST(column_name AS FLOAT).
Can I query or join two CSV files at once?
Not yet. Each session loads one CSV file into the single table named data, so a query can only read from that one table — there's no second file to join against. Dropping a new file replaces the current table rather than adding alongside it.
Is there a limit on how large a file I can query?
Yes — up to 50 MB and 1,000,000 rows. A file past either limit is rejected with a clear message before any query runs, rather than letting your browser tab stall or run out of memory partway through.