jibzar

SQL Formatter

Paste a compressed or messy SQL query to get it neatly indented and readable. Pick your database dialect so its quoting and keywords are recognized. The query is never executed or sent anywhere.

  • Fully offline

Loading…

Features

  • Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server, Oracle and BigQuery
  • Upper, lower or preserved keyword case
  • 2 or 4 spaces or tab indentation
  • Multiple statements at once
  • Errors show line and column
  • Works offline; the query is never run

Examples

One-line query

Input
select id, name from users where active = 1
Output
SELECT id, name FROM users WHERE active = 1

FAQ

Is my query executed?

No. Only its text is formatted; nothing connects to a database.

Why do I get a parse error?

Usually the wrong dialect is selected (for example MySQL backticks in PostgreSQL mode) or a parenthesis or quote is not closed.

Are comments kept?

Yes, -- and /* */ comments are preserved.