SQL Formatter
Paste a SQL query and get clean, readable output with consistent indentation and keyword casing. Or minify it to a single line. Everything runs in your browser.
Mode
Frequently Asked Questions
A SQL formatter rewrites a query with consistent indentation, line breaks and keyword casing so it is easier to read, review and debug. The query logic does not change, only its layout.
The formatter handles common ANSI SQL, PostgreSQL, MySQL and SQL Server syntax, including joins, subqueries, CTEs, CASE expressions, window functions, and INSERT, UPDATE and DELETE statements. Dialect-specific procedural code such as stored procedure bodies may not format perfectly.
No. Formatting runs entirely in your browser, so your queries, table names and data never leave your device.
Yes. Switch to Minify to collapse the query onto a single line with comments removed, which is useful for logs, config files and embedding SQL in code.
No. Only whitespace and the case of keywords and function names change. String literals, quoted identifiers and comments are preserved exactly.
Other Tools
Need a custom tool or website built?
I build custom web applications and business websites. See all services.
Can't find the tool you need?
Tell me what to build next. Every suggestion gets read.