SQL Formatter
Format and beautify SQL queries
Frequently Asked Questions
How does the SQL Formatter work?
Paste unformatted SQL and the tool adds proper indentation, line breaks, and keyword capitalization. SELECT, FROM, WHERE, JOIN, and other keywords are placed on new lines with consistent indentation for readability.
What SQL dialects are supported?
The formatter supports standard SQL, MySQL, PostgreSQL, SQL Server (T-SQL), Oracle PL/SQL, and SQLite syntax. Each dialect has specific keyword recognition and formatting rules. Select your dialect for optimal results.
Can I customize the formatting style?
Yes. Choose uppercase or lowercase keywords, indentation size (2 or 4 spaces), comma placement (before or after), and whether to align columns. You can also set line width limits for wrapping long expressions.
Does the formatter handle complex queries?
Yes. It properly formats subqueries, CTEs (WITH clauses), window functions, CASE expressions, nested JOINs, and UNION queries. Each nesting level receives additional indentation for clear visual hierarchy.
Can I minify SQL?
Yes. Switch to minify mode to remove all unnecessary whitespace and comments. This is useful for embedding SQL in application code or reducing the size of SQL files. The minified output is functionally identical.