SQL Formatter | Beautify SQL Online
Format and minify SQL with dialect-aware rules, indentation, keyword casing, optional leading commas, and CodeMirror highlighting—ideal for DB work and reviews.
Free online SQL formatter: beautify and minify queries for MySQL, PostgreSQL, T-SQL, and more—with indent, keyword case, and leading-comma options.
How to use
When to use
Clean up messy queries, align style before sharing, or prep SQL for documentation.
Workflow
- Pick the dialect and indent settings that match your engine.
- Paste SQL, upload a file, or load the sample.
- Click Format or press Ctrl/Cmd+Enter; use Minify when you need a compact payload.
- Copy or download the result; drag the handle to resize the editor.
Tips
- Leading commas can change layout versus the dialect default—review the output if you share it widely.
- If another page links here with ?sql=, the editor auto-fills from the decoded value.