Skip to content
Run here 100% in your browser, no upload, no login

SQL Formatter

Beautify or minify SQL while quoted strings and comments stay intact.

How to use it

  1. Paste a query into the left panel — from an ORM log, a migration file or a code review diff.
  2. Pick Beautify to reformat or Minify to collapse the statement to one line.
  3. Beautify puts SELECT, FROM, JOIN, WHERE, GROUP BY, ORDER BY and LIMIT clauses on separate lines and splits comma-separated fields onto their own indented lines.
  4. Strings inside single, double or backtick quotes and -- or block comments are never restructured.
  5. Use Copy or Download to take the result back into your editor or migration.

Common use cases

Why it stays private

The formatter is a self-contained lexer and rewriter running in your browser. Queries — including anything with table names, credentials in connection strings or business logic — never leave the page.

FAQ

Q: Does it validate or execute my SQL? A: No. It is a purely syntactic reformatter with a lightweight lexer, so it works for many dialects but performs no semantic checks and never talks to a database.

Q: Which dialects are supported? A: The clause set covers the common shared core (SELECT/FROM/JOIN/WHERE/GROUP BY/ORDER BY and friends) used by MySQL, PostgreSQL and SQLite. Dialect-specific syntax is preserved as-is rather than understood.

Q: Why does a keyword inside a string not get its own line? A: Quoted strings and comments are tokenized as single units and protected, so keywords that only appear inside them are left exactly where they are.

Your data stays on this device

SQL Formatter runs 100% locally. Everything you paste or drop is processed by your own browser and never transmitted. Nothing is stored on our servers — close the tab and it is gone.

Nothing you type is sent to a server, logged, or used for analytics. The page works even with your network disconnected after first load.