SQL Formatter
Paste a SQL query to make it readable, or minify it onto a single line.
What the formatter does
- Starts each main clause on a new line: SELECT, FROM, JOIN, ON, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT, UNION, INSERT, UPDATE, SET and VALUES.
- Puts each selected column on its own line, and each AND / OR condition on its own line.
- Indents subqueries inside brackets, so nested SELECTs are easy to follow.
- Writes keywords in UPPERCASE (optional) and adds spaces around operators.
Strings ('Lahore'), quoted identifiers ("Order", `table`, [column]) and comments are kept exactly as written, so the query works the same after formatting. Minify removes comments and extra spaces, which is useful for logs or embedding SQL in code.
Supported dialects
The formatter understands the common syntax of MySQL, MariaDB, PostgreSQL, SQLite and SQL Server. Very dialect-specific code, such as stored procedures or PL/SQL blocks, is tidied but may not be laid out perfectly. Your query is formatted in your browser and is never sent anywhere, so it is safe for production queries.
How it works
- Open — choose your file; it stays on your device.
- Work — make your changes right in the browser.
- Save — download the result straight to your device.
Related tools
View allPrefer to just describe the task? The AI Assistant can convert, compress and resize files from a short instruction.
Rate this tool
Log in to leave a review.