SQL Beautifier
Format SQL queries with clean indentation and optional uppercase keywords.
Runs in your browser Your input never leaves your device.
About this tool
Paste a SQL statement and the tool puts each clause on its own line with indented column lists, using the sql-formatter library. Choose the dialect that matches your database (Standard SQL, MySQL, PostgreSQL, SQLite, MariaDB or SQL Server), whether keywords are uppercased, and a 2 or 4 space indent. It changes layout only and never runs your query or connects to a database. If the formatter cannot parse the statement, the output shows a warning with its message instead. Everything runs in your browser, so your queries stay on your device.
How to use it
- Paste your SQL into the input box.
- Select the dialect for your database.
- Choose uppercase keywords and an indent size.
- Copy the formatted query.
Example
Standard SQL, uppercase keywords, 2 space indent.
select id,name from users where age>18 order by name limit 10
SELECT id, name FROM users WHERE age > 18 ORDER BY name LIMIT 10
Common problems
- A warning appears instead of formatted SQL
- The statement could not be parsed. Check for unbalanced parentheses or quotes, or choose the dialect you are actually using.
- Dialect-specific syntax fails
- Pick the matching dialect. For example, SQL Server syntax may not parse under Standard SQL.
- Keywords you wanted lowercase are uppercase
- Untick Uppercase keywords to keep them as typed.