SQL Formatter -- Prettify SQL Queries
Format and prettify SQL queries with proper indentation and uppercase keywords. Free online SQL formatter for SELECT, INSERT, UPDATE, and DELETE statements.
Frequently Asked Questions
How does SQL formatting work?
This tool parses your SQL query and applies consistent formatting: keywords are uppercased (SELECT, FROM, WHERE), each major clause starts on a new line, and nested clauses are indented. The result is readable, well-structured SQL.
What SQL dialects are supported?
This formatter handles standard SQL syntax including SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, JOIN, GROUP BY, ORDER BY, HAVING, UNION, and subqueries. It works with MySQL, PostgreSQL, SQLite, and SQL Server syntax.
Does it handle complex queries?
Yes. The formatter handles JOINs (INNER, LEFT, RIGHT, FULL), subqueries, CTEs (WITH clauses), CASE statements, and complex WHERE conditions with AND/OR. Nested subqueries are properly indented.
Can I minify SQL as well?
Yes. Toggle between format and minify mode. Minifying removes all unnecessary whitespace and line breaks, producing a compact single-line SQL string useful for query strings, logs, and API parameters.