SQL Formatter
Format SQL queries for PostgreSQL, MySQL, SQLite, or standard SQL. Paste a query, choose its dialect, and copy the indented result.
About SQL Formatter
Format a query from a log or an ORM so you can trace its joins and filters. The formatter applies consistent indentation and line breaks while preserving quoted values and comments.
How to use SQL Formatter
Enter a query
Paste one or more SQL statements or load the example.
Select the database dialect
Choose the dialect your database uses so the formatter can recognize its quoting and parameter syntax.
Format and copy
Select Format SQL, review the output, and copy it to your editor.
Frequently asked questions
Related developer tools
JSON Formatter · Beautifier · Validator
Format, minify, sort keys, and validate JSON/JSONC/JSON5 with optional JSON Schema validation. Supports comments and trailing commas.
YAML Formatter · Beautifier · Validator
Format, beautify, minify, and validate YAML online. Supports YAML 1.1 and 1.2, multi-document files, JSON Schema validation, key sorting, and anchor/alias handling. Deterministic output with customizable indentation and line width.