SQL Formatter & Beautifier
Turn a one-line query into readable, clause-aligned SQL — with keyword casing, comma breaks and highlighting. Everything runs in your browser.
Advertisement
SQL input
Ctrl + Enter to format
Formatted
Statements 0
Lines 0
Keywords 0
Size 0 B
About this SQL formatter
The formatter tokenises your SQL first, so it never rewrites the
inside of a string literal or a comment — a naive find-and-replace formatter will happily mangle
'SELECT' inside quotes, and this one does not.
- Major clauses (
SELECT,FROM,WHERE,GROUP BY,ORDER BY…) start a new line;JOINs andAND/ORget their own lines too. - Sub-queries in parentheses are indented as blocks, so nesting is visible at a glance.
- Handles
'strings'(including''escapes),"quoted"and`backtick`identifiers,--line comments and/* block */comments. - Works with MySQL, PostgreSQL, Oracle and SQL Server syntax for formatting purposes — it lays out the text and does not validate against a specific dialect.