SQL Formatter
Format, beautify and minify SQL queries with proper indentation.
How to use SQL Formatter
Three quick steps — no sign-up needed
-
Step 1
Paste your code
Paste your code or text into SQL Formatter — nothing leaves your browser.
-
Step 2
Format it
Click once to clean up, indent and standardise the formatting instantly.
-
Step 3
Copy the output
Copy the tidied result, ready to paste back into your project.
About SQL Formatter
SQL Formatter is a free online tool that beautifies messy SQL into clean, readable, properly indented queries — or minifies them into a single compact line. It uppercases keywords, breaks major clauses onto their own lines, indents subqueries and parentheses, and respects strings and comments so your code is never mangled. Everything runs in your browser, so your queries stay private, and it works on any device with no sign-up.
Benefits of SQL Formatter
Frequently asked questions
Is the SQL Formatter free?
Yes. It is completely free with no limits, no sign-up, and no watermarks.
Does my SQL get sent to a server?
No. Formatting happens entirely in your browser, so your queries never leave your device.
Which SQL dialects are supported?
It works with standard SQL and common dialects including MySQL, PostgreSQL, SQL Server and SQLite. It formats structure and keywords rather than validating dialect-specific syntax.
Can it minify SQL too?
Yes. Use the Minify option to collapse a formatted query into a single compact line, which is handy for embedding SQL in code.