SQL Formatter
Format and beautify SQL queries with customizable indentation and keyword casing...Format and beautify SQL queries with customizable indentation and keyword casing. Support for MySQL, PostgreSQL, SQLite, SQL Server, and standard SQL.
Formatted SQL will appear here...
Formatter Features
Why Use SQL Formatter?
Beautiful Formatting
Transform messy SQL into beautifully formatted, readable queries with proper indentation and line breaks.
Multi-Dialect Support
Works with MySQL, PostgreSQL, SQLite, SQL Server, Oracle, and standard SQL queries.
Customizable Output
Choose indentation size (2 or 4 spaces) and keyword casing (UPPER, lower, or preserve).
100% Private
All formatting happens in your browser. Your SQL queries never leave your device.
Common Use Cases for SQL Formatting
Code Reviews
Format SQL before code reviews to make queries easier to read and review for your team.
Query Debugging
Beautify complex queries to find logic errors, missing joins, or incorrect conditions.
Version Control
Standardize SQL formatting before commits for cleaner diffs and easier collaboration.
Documentation
Format SQL examples for documentation, tutorials, and knowledge base articles.
How It Works
Paste SQL Query
Enter your SQL query from your code editor, database client, or any source. Or use the sample query.
Choose Formatting Options
Select your preferred indentation (2 or 4 spaces) and keyword case (UPPER, lower, or preserve).
Format and Copy
Click Format SQL to beautify your query. Review the formatted output and click Copy to save it.
Tips for SQL Formatting
Use UPPER for Keywords
Most SQL style guides recommend UPPERCASE keywords (SELECT, FROM, WHERE) to distinguish them from table and column names.
Format Before Committing
Run your SQL through the formatter before committing to ensure consistent style across your team's codebase.
Check Comments
SQL comments (-- and /* */) are stripped during formatting. Add comments back after formatting if needed.