\n\n

SQL Formatter

Format and beautify SQL queries for readability. Runs entirely in your browser.

What Does This Formatter Do?

It adds line breaks and indentation to make SQL queries readable. Keywords are uppercased, and major clauses (SELECT, FROM, WHERE, JOIN, etc.) start on new lines.

Best Practices for Readable SQL

Uppercase Keywords

SQL keywords (SELECT, FROM, WHERE) are conventionally uppercased. Table and column names are lowercase. This makes queries easier to scan.

One Clause Per Line

Breaking SELECT, FROM, WHERE, GROUP BY, and ORDER BY onto separate lines makes complex queries much easier to debug.

Indent Subqueries

Nested queries should be indented one level deeper than their parent. This visual hierarchy is critical for understanding complex queries.

Frequently Asked Questions

Does this change my SQL?

No. Formatting only changes whitespace and keyword case. The query logic is preserved exactly.

Which SQL dialects are supported?

The formatter is dialect-agnostic. It works on ANSI SQL plus common extensions from MySQL, PostgreSQL, SQLite, and SQL Server.

Do you log my queries?

No. Everything runs in your browser. Nothing is sent to our servers.