SQL Formatter
Format, beautify, and minify SQL queries online
What is the SQL Formatter?
Written and maintained by the BitConvert team · Feb 27, 2026
SQL Formatter takes cramped, one-line, or inconsistently spaced SQL and rewrites it into clean, readable queries. It applies consistent indentation, places major clauses like SELECT, FROM, WHERE, and ORDER BY on their own lines, and standardizes keyword casing to uppercase so the structure of a statement is immediately clear.
You can pick the dialect that matches your database, including Standard SQL, MySQL, PostgreSQL, SQLite, MariaDB, T-SQL for SQL Server, and PL/SQL for Oracle, so quoting and syntax rules are respected. A minify option reverses the process, collapsing a query into a single compact line for embedding in code or config. The formatter only touches whitespace and casing, never the logic, and runs entirely in your browser so queries stay private.
Key Features
Multiple Dialects
Supports Standard SQL, MySQL, PostgreSQL, SQLite, MariaDB, T-SQL, and PL/SQL rules.
Keyword Casing
Normalizes keywords to uppercase and lays clauses out on separate, indented lines.
Minify Mode
Collapses a formatted query into one compact line for embedding in application code.
Logic Preserving
Only whitespace and casing change, so your query results stay exactly the same.
Common Use Cases
Clean up a query copied from application logs before reviewing it in a pull request. Make a long, nested query readable so a teammate can understand the joins and filters. Standardize SQL formatting across a project so every migration and report looks consistent. Minify a tuned query to paste into a code string or environment variable. Reformat generated SQL from an ORM to see what the database will actually run.
How It Works
Paste SQL
Paste your SQL query in the input field
Choose Dialect
Select your SQL dialect for proper formatting
Format or Minify
Click Format for beautified output or Minify for compact version
Frequently Asked Questions
Last updated: Feb 27, 2026