Skip to content
Marvin's Toolbox.

SQL Playground

Run real SQL on your own data with SQLite. Open a CSV, JSON or .sqlite file, or paste a table, and query it with joins, aggregates and window functions. Browse the schema, export results as CSV or JSON, and download the database.

Runs entirely in your browser. Nothing you put in here gets uploaded.

Database

Drop your data here

CSV, TSV, JSON or a SQLite database. Several files become several tables.

Query

Cmd or Ctrl and Enter runs the selection, or the whole script when nothing is selected.

Results

No results yet

Run a query, or click a table in the database panel.

Options

Used for the next file or paste.

Off keeps every CSV value as text.

Used for the next run. Exports are not cut to this.

Example queries

Each one loads the sample shop if it is missing, then runs.

Next steps

Send this tool's output straight into another tool.

Open a CSV or TSV file and read it as a proper table. Sort by any column, filter rows with a search or per-column conditions, hide columns you do not need, and copy or download what is left.

Paste JSON to explore it as a collapsible, searchable tree, hide the fields you don't need, and see the structure it implies as a badge-annotated schema and a copyable TypeScript interface.

Convert config and data between JSON, YAML, TOML, JSON5, INI, XML, CSV and .env. Type or paste on the left, pick the output format on the right, and copy the result. Includes a format button and a minify toggle.

Compare two JSON documents by structure and see every added, removed and changed key and value with its exact path. Browse the result as a tree, a filterable change list or a line diff, ignore array order, catch type changes and export the changes as a JSON report.

Convert text into every case at once: title case in the APA, AP, Chicago, MLA, Bluebook, AMA and NYT styles, sentence case, upper, lower, camelCase, snake_case, kebab-case and more.

Count words, characters, sentences, paragraphs, lines and more as you type, with estimated reading and speaking time.

Remove duplicate lines from a list or text, keeping the first occurrence. Optionally ignore case and whitespace, or drop blank lines too.

Replace text in two modes: plain find and replace all, or regular expressions with flag controls and capture group references like $1.

Compare two texts and see every added, removed and changed line highlighted, side by side or inline, with the changed words marked within each line. Ignore case, whitespace or blank lines, read a summary of how much changed, and export the result as a unified diff.

About the SQL Playground Tool

This tool gives you a real SQLite database to query. Drop in CSV, TSV, JSON or .sqlite files, or paste a table, and each one becomes a table you can join, group and filter with ordinary SQL, window functions and common table expressions included.

Columns get real types, so numbers sort and sum as numbers while IDs with leading zeros stay intact. Write one statement or a whole script, read each result in its own tab, and take the rows with you as CSV or JSON. The database itself can be downloaded and opened in any SQLite client.

What you can do

  • Query a CSV file with SQL without installing anything
  • Join several CSV and JSON files as tables
  • Open a SQLite database file and browse its tables
  • Run SQL on a JSON array of objects
  • Turn a CSV file into a SQLite database and download it
  • Paste cells from a spreadsheet and query them
  • Practice SQL joins, aggregates and window functions on a sample shop database
  • Export query results as CSV or JSON

How to use the SQL Playground

  1. 1Drop your files into the Database panel, paste a table, or press Sample data.
  2. 2Click a table to start a query on it, or open its columns with the arrow beside it.
  3. 3Write your SQL and press Run, or Cmd or Ctrl and Enter. With text selected, only the selection runs.
  4. 4Read the rows in Results. A script with several queries gets one tab per statement.
  5. 5Download the result as CSV or JSON, or download the whole database from the Database panel.

How files become tables

A table takes its name from the file, so Sales 2026.csv becomes Sales_2026, and a name that is already in use gets a number. Column headers lose their spaces and punctuation the same way, which means you rarely have to quote anything. The delimiter is detected, and a Markdown table or cells copied from a spreadsheet work as well.

Each CSV column gets a type from its values. Whole numbers become INTEGER and decimals REAL, with currency symbols and thousands separators removed. Blank cells become NULL, and true and false become 1 and 0. Anything that would lose information stays text: postcodes with leading zeros, yes and no, and dates, which keep the form they were written in. ISO dates work with SQLite's date functions as they are. Turn off Detect column types to keep every value as text.

A JSON array of objects becomes one table with a column for every key found in any object. Nested objects and arrays are stored as JSON text, ready for json_extract. An object holding several arrays gives one table per array, and JSON lines files work too. A database file replaces the current session, and any text files dropped with it land inside it as new tables.

Scripts, errors and stopping a query

Statements run one after another. When one fails, the error names the statement and the line, the statements before it stay applied, and the rest do not run. That is how the sqlite3 shell behaves too, so wrap a script in BEGIN and COMMIT if it should be all or nothing.

Queries run on a background thread, so the page stays usable during a slow one. Stop ends a query that takes too long and returns the database to how it was before that run. Temporary tables are lost when that happens, and so are changes in a transaction that was never committed.

Big results

The table shows the first rows of a result, 500 by default, and always reports the true row count. The exports hold every row up to five million cells across the run, which is more than a spreadsheet can open. Query text and settings are remembered between visits. Loaded data is not, so download the database if you want to keep your tables.

Credits

Open source does the heavy lifting in this tool. Thank you to:

  • sql.js

    SQLite compiled to WebAssembly, a full relational database that runs without a server.

Everything this site builds on is listed on the credits page.

Tools that share a tag with this one.

Format code in JavaScript, TypeScript, JSON, JSON5, HTML, Vue, CSS, SCSS, LESS, Markdown, YAML, GraphQL, XML and SQL. Pick tabs or spaces, set the indent width, and format the input in place with one click.

Paste or drop application logs and read them as a clean, structured list. Detects logfmt, JSON lines and common plain-text formats, colors levels and timestamps, and lets you expand or collapse the fields of every entry.

Encode and decode Base16, Base32, Base36, Base45, Base58, Base62, Base64 and Base85. Pick the alphabet variant you need, from Crockford Base32 to Bitcoin Base58 and Ascii85, and convert in either direction.

Decode Base64 to text or encode text to Base64. Paste into the top box, read the result below, and flip the direction with one click. Handles Unicode correctly, reads URL-safe Base64, and shows binary payloads as a hex dump you can download.

Convert config and data between JSON, YAML, TOML, JSON5, INI, XML, CSV and .env. Type or paste on the left, pick the output format on the right, and copy the result. Includes a format button and a minify toggle.

Open a CSV or TSV file and read it as a proper table. Sort by any column, filter rows with a search or per-column conditions, hide columns you do not need, and copy or download what is left.