SQL Formatter
Format common SQL clauses while preserving quoted text and comments.
Input
Result
How it works
A lexical scanner keeps quoted identifiers, literals, dollar-quoted strings, and comments intact. It starts a new line before recognized top-level clauses. This tool formats SQL text without executing it or validating a database dialect.
Example
SQL input: select id, name from accounts where active = 1 order by name;
SELECT, FROM, WHERE and ORDER BY appear on separate lines.