SQL beautifier
Paste a SQL query and get a cleanly indented, readable version instantly. Choose your SQL dialect to match the formatting conventions of your database.
Dialect:
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
select u.id, u.name, count(o.id) as orders from users u left join orders o on o.user_id = u.id where u.active = 1 group by u.id, u.name order by orders descFormatted
SELECT
u.id,
u.name,
count(o.id) AS orders
FROM
users u
LEFT JOIN orders o ON o.user_id = u.id
WHERE
u.active = 1
GROUP BY
u.id,
u.name
ORDER BY
orders DESCProcessing 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
- What is SQL beautification?
- SQL beautification (also called formatting or pretty-printing) reformats a SQL query with consistent indentation, line breaks, and keyword casing to make it easier to read and maintain.
- Does formatting change the meaning of my SQL?
- Formatting only changes whitespace and capitalisation. It does not alter the logic, execution plan, or result of the query.
- Is my SQL sent to a server?
- All processing runs in your browser using JavaScript. Our servers are not involved at any point.
- Which SQL dialects are supported?
- Standard SQL, MySQL, PostgreSQL, and T-SQL (Microsoft SQL Server). Select the appropriate dialect to get formatting that matches your database's conventions.
Last reviewed September 30, 2026
Other pages for this tool
Related tools
Regex tester
Test regular expressions with a live match list, replace, and split modes. Runs in your browser.
YAML formatter
Format, validate, and convert YAML. Compatible with Kubernetes, CI configs, and OpenAPI files.
JSON formatter
Pretty-print, minify, validate, and sort JSON keys. Instant output.
- Background reading: Complete guide to developer tools