DuckDB WASM Playground
Run SQL analytics on local data without uploading it
SQL editor
Status: Not connected
Local file examples
SELECT * FROM read_csv_auto('data.csv') or SELECT * FROM read_json_auto('data.json'). Files stay in this browser session.DuckDB WebAssembly loads only when you connect. Use read_csv_auto('data.csv') or read_json_auto('data.json') for local analytics; your data never leaves the browser.
Examples
Comment-safe batch split
splitDuckDbStatements("SELECT 1; -- note;\nSELECT 'a;b'")["SELECT 1", "-- note;\nSELECT 'a;b'"]Semicolons inside comments and string literals never split statements.
Bigint-safe normalization
normalizeDuckDbResult({ schema: { fields: [{ name: "id" }] }, toArray: () => [{ id: BigInt(4) }] }){ columns: ["id"], rows: [{ id: "4" }] }Schema fields name the columns while the bigint renders as a string.
About this tool
DuckDB WASM Playground runs analytical SQL in the browser with connectDuckDb and executeDuckDb(sql, connection): the @duckdb/duckdb-wasm bundle lazy-loads behind a Web Worker, statements execute in order, and the last result normalizes to { columns, rows }.
Splitting is comment- and literal-safe through splitDuckDbStatements: single, double, and backtick quoting with doubled-quote escapes plus line and block comments keep semicolons inside 'a;b' or /* x; */ intact, while empty input yields no statements.
Result shaping is deterministic through normalizeDuckDbResult: Arrow-style toArray results and plain record arrays both normalize, bigint values stringify without precision loss, dates become ISO strings, schema fields win for columns, and empty SQL throws Enter at least one SQL statement.
How to use this tool
Connect the engine
Start the WASM database in a browser with Web Worker support.
Write SQL batches
Separate statements with semicolons; quoted and commented semicolons stay intact.
Execute in order
Run the batch and read the normalized last-statement table.
Check types
Expect bigints as strings and dates as ISO timestamps in rows.
Use cases
Prototyping analytical queries
Test SELECT, aggregation, and JOIN flows in a disposable browser database.
Splitting migration scripts
Divide multi-statement SQL without breaking quoted or commented semicolons.
Handling 64-bit integers
Read counts and ids above Number.MAX_SAFE_INTEGER as exact strings.
Common mistakes
Mistake:Expecting every statement's rows back.
Fix:Only the final result normalizes — run queries one at a time to keep each table.
Mistake:Sending empty SQL and expecting an empty table.
Fix:Delimiter-only input has no statements, so execution throws instead of returning rows.
Mistake:Parsing bigint results as numbers.
Fix:Bigints arrive stringified to preserve precision — compare them as strings.
Frequently asked questions
What does this tool do?
It connects a browser DuckDB WASM engine with Web Worker support and executes SQL batches via executeDuckDb, returning the normalized last-statement table of columns and rows.
How are statements split and results shaped?
Splitting skips semicolons inside single, double, and backtick quotes with doubled-quote escapes plus line and block comments, and normalization stringifies bigints, ISO-formats dates, and prefers schema fields for columns.
Is my SQL uploaded or stored?
No. WASM startup, batch execution, and result normalization run fully client-side.
Why an empty-statement error, or strings where numbers were expected?
Delimiter-only input has no executable statements so it throws, only the final result returns, and bigints arrive as strings to preserve precision past Number.MAX_SAFE_INTEGER.
Related guides
References & standards
Related tools
.env Secret Safety Linter
Validate .env syntax and spot likely leaked credentials or placeholder secrets.
.htaccess Generator
Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth
2D Fluid Dynamics & Particle Physics Sandbox
A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.
AI Function Calling Schema Generator
Generate function calling JSON schemas from TypeScript interfaces
Algorithm Arena & Data Structure Visualizer
Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.
Ansible Playbook Generator
Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML