SQL Formatter
Format and beautify SQL queries for MySQL, PostgreSQL, SQL Server, SQLite and Oracle.
Runs in your browser — your data never leaves your device.
About the SQL Formatter
Turn a long single-line query from a log file or ORM into clean, indented SQL that is easy to read, review and debug. Choose your database dialect so its special syntax is understood, and whether keywords should be upper or lower case.
How to use the SQL Formatter
- Paste your SQL.
- Choose the dialect, keyword case and indentation.
- Copy the formatted SQL.
How it works
Queries are parsed and re-printed with the open-source sql-formatter library (MIT). Each clause starts on a new line and nested queries are indented. Comments and string values are kept.
Examples
select id,name from customers where city='Jhelum' and balance>1000 order by name→ SELECT, FROM, WHERE and ORDER BY each on their own lines, with conditions indented.
Frequently asked questions
Is my data sent to your server?
No. Everything runs in your browser, on your own device. Nothing you type, paste or choose is uploaded or stored.
Does it check whether my SQL is correct?
It reports syntax it cannot understand, but it does not run the query or check table and column names.