⚡ 110+ free online tools — no sign-up, no watermarks. Explore now →

★ Free Developer Tool

SQL Formatter and Beautifier (MySQL, PostgreSQL, SQL Server)

Format messy SQL into readable, indented queries for MySQL, PostgreSQL, SQL Server, Oracle, SQLite and more. Minify SQL too.

Loading the tool…

Runs entirely in your browser. Your files and text are never uploaded to our server.

About this toolSQL Formatter makes long, one-line queries easy to read. Paste your SQL, choose the database dialect, and get clean, indented SQL with consistent keyword case.
Learn more
  • Instant results
  • 100% free
  • No sign-up
  • Private

SQL Formatter makes long, one-line queries easy to read. Paste your SQL, choose the database dialect, and get clean, indented SQL with consistent keyword case. You can also minify SQL to a single line.

More about SQL Formatter and Beautifier (MySQL, PostgreSQL, SQL Server)How to use, good to know & FAQ

How to format SQL

  1. Paste your query into Your SQL.
  2. Choose the dialect (MySQL, PostgreSQL, SQL Server, Oracle, SQLite, BigQuery and more), keyword case and indent.
  3. Click Format SQL, then Copy or Download .sql.
  4. Use Minify to remove comments and extra spaces.

Good to know

  • Formatting only changes spacing and keyword case. It does not change what the query does.
  • Choosing the right dialect helps with database-specific syntax, such as backticks in MySQL or square brackets in SQL Server.
  • If a query cannot be formatted, check for a missing quote or bracket, or try another dialect.

Frequently asked questions

Is my SQL sent to a server?

No. Formatting happens in your browser, so it is safe to use with internal queries. Only the open-source sql-formatter library is downloaded.

Does it check whether my SQL is correct?

No. It formats the query but does not run it or check it against your database.

Can it format several queries at once?

Yes. Separate them with semicolons and each one is formatted, with a blank line between them.