SQL Formatter
About SQL Formatter
Paste a messy, minified, or copied SQL query and the formatter indents and capitalizes it into clean, readable SQL. It handles SELECT, INSERT, UPDATE, DELETE, CREATE TABLE, subqueries, Common Table Expressions, and complex joins, and supports dialects including MySQL, PostgreSQL, SQL Server (T-SQL), and standard SQL. Useful for reviewing copied queries, preparing SQL for code review, and making log output legible. Formatting runs entirely in your browser.
How To Use
- Paste your SQL query into the input.
- Choose a SQL dialect if needed (MySQL, PostgreSQL, SQL Server, or standard SQL).
- Format the query and copy the cleanly indented result back into your editor or ticket.
Example
Input: A long, single-line SELECT query with multiple joins and a subquery.
Output: The same query, indented across lines with keywords capitalized and clauses aligned.
Who Uses SQL Formatter
- Developers who prefer private, browser-only tools for formatting, validation, and data work.
- Engineers who need fast local tools without installing anything or uploading code.
- Teams that want private — files and text stay on your device and are never uploaded to a server.
Frequently Asked Questions
Which SQL dialects are supported?
Standard SQL plus MySQL, PostgreSQL, and SQL Server (T-SQL). The formatter adjusts keyword handling and syntax for the selected dialect.
Will it change the logic of my query?
No. Formatting only changes whitespace, capitalization, and line breaks — the query's meaning and results are unchanged.
Does it handle complex queries?
Yes. Subqueries, CTEs (WITH clauses), UNIONs, window functions, and multi-table joins are all indented correctly.
Is my SQL uploaded anywhere?
No. Formatting runs locally in your browser, so you can safely paste queries that reference real table or column names.