Category: Developer tools

SQL Formatter

Format and beautify SQL queries in your browser

Paste a SQL query to reindent it with clear line breaks around clauses, joins and conditions. Nothing is uploaded or run against a database.

Paste a SQL query to format it.

Result
The result will appear here.

Everything on this page is processed in your browser. Nothing is uploaded.

What this tool does

This formatter re-flows whitespace around a fixed set of standard keywords — select, from, where, joins, group by, order by and more — so a long query becomes readable at a glance. It never executes anything: strings, identifiers and comments are tokenized and left untouched, and words outside the keyword list are treated as plain identifiers rather than guessed at.

How to use it

  1. Paste your SQL query into the input box, or load the example.
  2. Choose 2 or 4 space indentation and whether keywords should be UPPER, lower or left as typed.
  3. Copy the formatted result.

Privacy

This tool runs entirely in your browser. Your input is never uploaded, stored or shared — closing the tab removes it.

Frequently asked questions

Does this run my query against a database?
No. The text is only tokenized and reformatted by JavaScript in the page; it is never sent anywhere or executed.
Which SQL dialect does it support?
It recognises common ANSI SQL keywords shared by PostgreSQL, MySQL, SQLite and SQL Server. Dialect-specific functions are left alone rather than misformatted.
Will it change my query's meaning?
No. Only whitespace, line breaks and keyword casing are changed — strings, identifiers and comments are copied through exactly as written.