Free SQL Formatter & Beautifier
Format and beautify messy SQL queries instantly with proper indentation.
About this tool
How to use
Frequently Asked Questions
This formatter uses a generic ruleset that works well with standard SQL, MySQL, PostgreSQL, SQLite, and SQL Server. It handles standard keywords like SELECT, JOIN, WHERE, GROUP BY, etc.
No. This tool only formats the text string of the query. It does not connect to any database or validate if the tables/columns actually exist.
The Minify button does the opposite of formatting: it removes all unnecessary whitespace and line breaks, compressing the query into a single line. This can be useful when you need to paste a query into a single-line text field or string variable in code.
Related Tools
HTML Formatter
Format and beautify messy HTML code instantly with proper indentation.
JSON Formatter & Validator
Format, validate, prettify, and clean JSON code online with error detection.
Diff Checker
Compare two blocks of text or code and highlight the differences instantly.