ToolHub
๐Ÿ—„๏ธ

SQL Formatter

Uppercase keywords and structure SQL queries.

Formatted SQL
โ€”

Basic formatter: uppercases keywords, breaks major clauses onto new lines and indents conjunctions. Complex dialect-specific syntax is passed through as-is.

About the SQL Formatter

Turn a cramped one-line query into readable SQL. Major clauses like SELECT, FROM, WHERE and JOIN each move to their own line, keywords are uppercased, conjunctions such as AND and OR are indented, and commas in select lists break neatly. String literals are protected so their contents are never reformatted.

How to use the SQL Formatter

  1. Paste your query into the editor.
  2. Pick an indent size: 2, 4 or 8 spaces.
  3. Read the formatted SQL in the output box.
  4. Copy it back into your editor, migration or documentation.

SQL Formatter FAQ

Which keywords are recognized?

Around 50 of the most common ones โ€” SELECT, INSERT INTO, UPDATE, DELETE FROM, all JOIN variants, GROUP BY, ORDER BY, UNION, CASE, WHEN and more โ€” all uppercased automatically.

Will it break dialect-specific syntax?

The formatter is deliberately conservative: unknown syntax passes through unchanged, and string literals are shielded from rewriting, so PostgreSQL or MySQL extensions stay intact.

Does it handle multiple statements?

Yes. Each semicolon is followed by a blank line, so batches of statements remain visually separated after formatting.