SQL formatter: make long queries readable

Paste a SQL query and get it back with each clause on its own line, indented columns and conditions, and optional uppercase keywords.

  • Free, no sign-up
  • Your files and data stay on your device
  • No watermarks or limits

0 bytes uploaded. Everything happens in this tab.

How to use it

  1. Paste your query.
  2. Choose the indentation and whether to uppercase keywords.
  3. Press Format for a readable query or Minify for a single line, then copy.

Example

Formatted query:

SELECT
  id,
  name
FROM users
WHERE active = 1
  AND age > 18

About this tool

Queries copied from logs or code are often one very long line. Splitting them into clauses makes it much easier to review joins, conditions and groupings, and to find what is wrong.

The formatter recognizes the common SQL clauses (SELECT, FROM, JOIN, WHERE, GROUP BY, ORDER BY, LIMIT, INSERT, UPDATE and others), puts each on a new line, lists columns one per line and indents AND and OR conditions. Strings and quoted names are left untouched.

It changes layout only. It does not parse every dialect in full, so very unusual syntax may be laid out imperfectly, and it never connects to a database or runs your query. Nothing you paste is sent anywhere.

Frequently asked questions

Which SQL dialects are supported?

It works on standard SQL layout and is tolerant of MySQL, PostgreSQL, SQLite and SQL Server queries, but it is a layout tool, not a full parser.

Does it change my keywords?

Only their letter case, if “Uppercase keywords” is on. Table and column names are not touched.

Can it run the query?

No. It never connects to a database.

Is my query uploaded?

No, it is processed locally in your browser.

Often used next