You are offline. Tools you have opened before keep working.
SQL formatter
Make long SQL queries readable: every clause on its own line, joins and conditions indented, subqueries nested clearly and keywords in the case you prefer.
Free and private. Everything runs in your browser, nothing is uploaded.
SQL
SQL
Report a problem
How it works
Paste your SQLPaste the code, type it or open a file. Try Sample to see an example.
Check the resultThe result appears on the right as you type. Errors are shown with the line and column.
Copy or downloadCopy the SQL with one click or download it as a file.
Built for everyday database work
Queries copied from logs, ORMs and stored procedures are often one long line. The formatter puts SELECT, FROM, WHERE and the rest on their own lines, lists selected columns one per line and lines up AND and OR conditions.
SQL Server brackets, MySQL backticks, PostgreSQL dollar quoted bodies, N'text' literals and GO separators are all recognized.
Queries generated by ORMs and logs
SQL captured from Entity Framework, Hibernate, a slow query log or a database profiler usually comes as one line full of generated aliases and parameters such as @p0. Formatted, each JOIN sits on its own line with its ON condition, the selected columns form a list and subqueries are indented, so you can see which table is joined twice or which filter applies to which table.
Keywords can be written in uppercase, in lowercase or left as they are, while table names, aliases and text values are never touched. Line comments and block comments stay where they were, which keeps the notes inside stored procedures intact.
About SQL
SQL is the language of relational databases. The formatter puts each clause on its own line, indents joins, conditions and subqueries, and works with SQL Server, MySQL, PostgreSQL and SQLite syntax.
Frequently asked questions
Does it change my query?
Only whitespace and, if you choose, the case of keywords. Table names, column names and text values are never changed.
Does it check whether my SQL is valid?
Only in part. It is not connected to a database, so wrong table or column names are not found. Unclosed quotes, quoted names and comments are reported with their line and column.
Can I turn a formatted query back into one line?
Yes. Switch the action to Minify. The query is written on one line and comments are removed, except optimizer hints written as /*+ ... */ and /*! ... */.
Is my code uploaded anywhere?
No. Formatting and minifying run in your browser. Your code is not sent to our servers.
Does minifying rename my variables?
No. Minifying removes comments, line breaks and spaces only. Names stay readable and the code behaves exactly the same, which makes it safe for any file.
Why are some line breaks kept in minified JavaScript?
JavaScript treats some line breaks as the end of a statement. Where removing one could change what the code does, it is kept.
Can I format JSON here?
JSON has its own tool with a tree view and validation. Use the JSON Tools page linked below.
Does it work offline?
Yes. After you open the page once, it keeps working without an internet connection.