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.
Example
Input
update t set a = 1 where id = 7; delete from t where a is null;Formatted
UPDATE t
SET
a = 1
WHERE
id = 7;
DELETE FROM t
WHERE
a IS NULL;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?
- Click the 'MySQL' dialect button, paste your query, and click Format SQL. 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 keyword casing and does not fix errors. If it cannot parse your SQL, it reports the line and column where parsing failed instead of formatted output.
- Are comments kept?
- Line comments (--) and block comments (/* */) stay in the output beside the code they annotate: -- active users stays on its own line above the formatted SELECT.
Last reviewed September 30, 2026
Other pages for this tool
Related tools
- Background reading: Complete guide to developer tools