SQL Formatter & Beautifier

Clean up messy SQL queries instantly. Our formatter adds proper indentation, standardizes keywords, and makes complex database queries much easier to read.

Why beautify your SQL?

Better Readability

Identify complex joins and nested conditions at a glance with logical indentation.

Standardized Style

Maintain consistent coding standards across your team and documentation.

Debugging Aid

Spot missing commas or misplaced keywords faster in a structured layout.

About the SQL Formatter

Paste a long or minified SQL query and get it laid out on separate lines with uppercase keywords, so you can read, review and debug it.

Everything you enter is processed in your browser; nothing is uploaded or stored.

How to use it

  1. Paste the SQL into Unformatted SQL.
  2. Read the formatted query on the right.
  3. Copy it into your code, a ticket or documentation.

What the formatter changes

Keywords such as SELECT, FROM, WHERE, AND, OR, JOIN, GROUP BY, HAVING, ORDER BY and LIMIT start a new line and are written in uppercase, so each clause and condition of the query stands on its own line. Table names, column names and values are left as you wrote them.

Formatting does not change what the query does; the database runs it the same way.

Example

select id,name from users where active=1 order by name becomes SELECT id,name FROM users WHERE active=1 ORDER BY name

Common mistakes

  • Pasting several statements without semicolons between them, which makes the output hard to read.
  • Keywords inside string literals (for example 'select') can be capitalised too; check queries with such strings.
  • Relying on formatting to find logic errors: check joins and WHERE conditions as well.

Frequently asked questions

Does it work with MySQL and PostgreSQL?

Yes. It formats common SQL keywords, which are the same across MySQL, PostgreSQL, SQL Server and SQLite.

Is my query sent anywhere?

No. It is formatted in your browser.

How do I put it back on one line?

Use the SQL Minifier.