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 for MySQL, PostgreSQL & 10+ dialects. Beautify queries with custom indent, keyword casing & leading commas. Boost readability for dev & DBA workflows.
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.