Free SQL Formatter & Beautifier
Paste your SQL query below to instantly format it for readability. Handles SELECT, INSERT, UPDATE, DELETE, JOIN, WHERE, GROUP BY, ORDER BY and subqueries. All processing is local.
About the SQL Formatter
This free SQL formatter reformats SQL queries by placing major keywords on new lines, indenting nested clauses, and applying consistent uppercase or lowercase keyword formatting. It supports ANSI SQL as used by MySQL, PostgreSQL, SQLite, SQL Server, and Oracle.
Use it to clean up auto-generated queries from ORMs, format SQL before adding to documentation, or debug complex multi-join queries by making the structure visible.
How to Format SQL
Paste Your SQL
Copy your SQL query and paste it into the input area.
Choose Keyword Case
Select UPPERCASE (standard) or lowercase for SQL keywords.
Format
Click "Format SQL". The output shows a clean, indented query.
Copy
Copy the formatted SQL to clipboard for use in your IDE or documentation.
Frequently Asked Questions
The formatter handles ANSI SQL keywords common to MySQL, PostgreSQL, SQLite, SQL Server and Oracle including SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, JOIN variants, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT, OFFSET.
Yes. Both single-line comments (--) and block comments (/* */) are preserved in their position relative to the surrounding SQL.
No. String literals enclosed in single quotes are preserved exactly as-is. Only SQL keywords are reformatted for case.
The formatter handles standard DML and DDL statements well. Procedural SQL (PL/pgSQL, T-SQL BEGIN/END blocks) may have partial formatting support as procedural keywords are less standardised.