SQL Formatter Converter

Make long queries readable with consistent keyword layout.

Runs in your browser Free · no accountFile upload supported

SQL

Formatted SQL

This conversion happens locally in your browser. Your files are never uploaded.

About the SQL Formatter converter

A query pulled out of an ORM log or a stack trace arrives as one unbroken line. This formatter puts each major clause on its own line, indents the conditions that hang off them, and standardises keyword case.

String literals, quoted identifiers and comments are tokenised first, so nothing inside them is ever rewritten — a value containing the word `select` stays exactly as written.

The layout it produces

SELECT, FROM, WHERE, JOIN variants, GROUP BY, HAVING, ORDER BY and LIMIT each start a new line at the base indent. AND, OR and ON are indented one level so the conditions belonging to a clause read as a group.

Parentheses increase the indent, which keeps subqueries and function arguments visually contained.

Dialects

The formatter is dialect-agnostic. It recognises standard SQL keywords and treats everything else as an identifier, so PostgreSQL, MySQL, SQLite, SQL Server and Snowflake queries all format sensibly.

It does not validate. A query with a syntax error still formats — the formatter is not a parser for the whole language.

Frequently asked questions

Will it break my query?

Only whitespace and keyword casing change. Identifiers, literals and comments are preserved byte for byte.

Why uppercase keywords?

It is the long-standing convention, and it makes the structure of a query scannable at a glance. Turn it off if your team writes lowercase.

Can I format several statements at once?

Yes. Statements separated by semicolons are each formatted and separated by a blank line.