SQL Formatter

中

Loading...

SQL Formatter — Beautify and Minify Queries in Any Dialect

Turn dense one-line SQL into cleanly indented, readable queries — or minify formatted SQL back into a compact single line for logs and transport. Supports the dialect-specific syntax of MySQL/MariaDB, PostgreSQL, SQLite, and more via a battle-tested formatting engine.

Paste a query dumped from an ORM, extracted from a slow-query log, or copied from a code review, and get properly capitalized keywords, sensible line breaks, and indented subqueries instantly. Formatting is local; your queries never leave the browser.

How to format SQL

  1. Paste your SQL statement into the editor.
  2. Select the dialect that matches your database.
  3. Click Format to beautify, or Minify to collapse to one line.
  4. Adjust indentation width if your team style requires it.
  5. Copy the result.

Frequently asked questions

Which SQL dialects are supported?

The formatter understands the common core plus dialect specifics for MySQL/MariaDB, PostgreSQL, SQLite, T-SQL (SQL Server), PL/SQL (Oracle), and N1QL, among others. Formatting is syntax-aware, not a naive keyword replace.

Does formatting change how my query runs?

No. Only whitespace, capitalization, and line breaks change — semantics are untouched. Always paste the formatted version back into your actual environment for a final check if the query is critical.

Why minify SQL?

Single-line queries are easier to log, embed in URLs or JSON payloads, and diff in some pipelines. Minified SQL still executes identically.

Related tools

PureKit · sql · Free online tool — files processed locally in your browser, no upload.