SQL Formatter
Lightly format SQL by collapsing whitespace and inserting line breaks before selected keywords.
How to use
- Enter SQL and run to inspect the lightweight formatting.
Capabilities and scope
It does not use a SQL parser; a case-insensitive keyword pattern covers SELECT, FROM, WHERE, joins, GROUP BY, and several other clauses.
How it works
Whitespace is first collapsed to single spaces, then newlines are inserted before a fixed keyword set.
Example
SELECT a FROM t WHERE id=1 is split around SELECT, FROM, and WHERE clauses.
Useful for
- Make a short query easier to scan quickly
Before you use it
- String literals, dialect-specific syntax, and indentation are not parsed or understood.
Frequently asked questions
Does it validate SQL syntax?
No. This is a string-based formatter, not a SQL parser or validator.