Format SQL online
Format any SQL query with proper indentation and consistent keyword casing. Paste minified or messy SQL and get a clean, readable version back. Supports multiple SQL dialects.
Formatting runs entirely in your browser.
How it works
The tool uses the sql-formatter library, a dialect-aware SQL pretty-printer that runs entirely in your browser. It parses your query and re-emits it with consistent indentation and capitalisation. No server required.
Processing runs in your browser
All formatting happens locally in your browser tab. Our servers are not involved at any point.
Related operations
For inspecting JSON returned by queries, try the JSON formatter. To validate identifier patterns in your SQL, use the regex tester. For converting query results into structured rows, see CSV to JSON.
Frequently asked questions
How do I format a MySQL query?
Select 'MySQL' from the dialect dropdown, paste your query, and click Format. The formatter will apply MySQL-appropriate keyword casing and indentation.
Can I format multiple SQL statements at once?
Yes. Paste multiple statements (separated by semicolons) and all will be formatted together.
Does the formatter fix SQL errors?
The formatter only adjusts whitespace and formatting. If your SQL has syntax errors, they will remain after formatting, though the improved readability may help you spot them.