SQL Formatter
Pretty-print SQL with consistent keyword casing and line breaks.
Paste any SQL query - SELECT, INSERT, UPDATE, DELETE, WITH. We break before each top-level keyword (FROM, WHERE, JOIN, GROUP BY, ...) and align SELECT columns one per line. Pick a keyword case and copy the result.
How to use it
Paste your SQL
Any common dialect. Sample loaded by default.
Pick a keyword case
UPPER, lower or Preserve. UPPER is most common in code reviews.
Copy the result
Formatted output appears in the right pane. Copy button next to the heading.
What is it?
A SQL formatter takes a one-line, hand-written or auto-generated query and produces readable, multi-line SQL with consistent indentation and keyword casing. Standard housekeeping before code review, before committing a migration, or before sharing a query in chat.
When to use it
Reading a one-liner from a log, cleaning up a generated query from an ORM, preparing SQL to paste in a Slack thread, or refactoring a slow query - the formatted form is easier to follow when you're staring at a WHERE clause for the third time.
Common mistakes
Treating the output as a parsed/validated query - it isn't validated. Database dialect quirks (PL/pgSQL, T-SQL, MySQL backticks) may format oddly. And don't rely on the formatter for security: it does not escape user input.
FAQ
- Is this a real SQL parser?
- No. It's a lightweight tokeniser that recognises common keywords and breaks lines around them. Works for typical queries; won't reformat exotic edge cases perfectly.
Related tools
More in this category
- JSON Formatter & Validator
- Base64 Encoder / Decoder
- URL Encoder / Decoder
- Hash Generator (SHA-1, SHA-256, SHA-384, SHA-512)
- JWT Decoder
- Regex Tester
- Markdown to HTML Converter
- YAML to JSON Converter
- CSV to JSON Converter
- HTML Entity Encoder / Decoder
- Cron Expression Reader
- XML Formatter
- HTML Minifier
- Mock Data Generator
- Markdown Table Generator