SQL Formatter
Pretty-print and syntax-highlight SQL statements.
How to Use
- Paste a SQL query.
- Pick keyword case and indent.
- Copy formatted result.
Input
Formatted
Paste SQL above.
Notes
Line break
Before major clause
SELECT, FROM, WHERE…
Comma
Column lists break
Sub-queries
Indent +1
Case
UPPER keywords = convention
Semicolons
Preserved
Comments
-- and /* */ kept
Frequently Asked Questions
Dialect?
Mostly ANSI. Handles common PostgreSQL/MySQL/SQLite clauses.
Strings?
Single-quoted and $$dollar-quoted$$ strings preserved verbatim.
Common Use Cases
Log cleanup
Format a one-liner back to readable.
Code review
Consistent style.
Last updated: