Skip to content

SQL formatter

Make your SQL queries readable: indentation, uppercase keywords and one clause per line.

Raw SQL query
Formatted query
{{ error }}

Why format your SQL code?

SQL (Structured Query Language) is a permissive language. A query works technically the same whether it is written on a single line or spread over 50 lines. However, queries generated by server logs, ORMs (such as Eloquent, Hibernate or Prisma) or exported through database dumps often come as compact, unreadable blocks.

SQL formatting (beautifying) restructures this text to make it understandable to a human by applying several standard development rules:

  • Converting all reserved keywords (SELECT, FROM, WHERE, JOIN...) to UPPERCASE.
  • Adding line breaks before the main clauses.
  • 4-space indentation for subqueries and complex conditions (AND, OR).

Handling different database dialects

Although the ANSI SQL standard exists, each major database management system (DBMS) has its own specific functions, data types and operators.

Our tool lets you select the exact dialect of your database (MySQL, PostgreSQL, Microsoft SQL Server, etc.). The algorithm adapts the formatting to respect the unique syntax of your technology (for example, handling backticks ` in MySQL or double quotes " in PostgreSQL).

Privacy and security

Your SQL queries often contain table names, architecture structures or sensitive data. This tool is designed to run entirely on the client side in your browser. No query is sent to or saved on our servers.

More developer tools:

How it works

How to use the SQL formatter

Make your SQL queries readable: indentation, uppercase keywords, one clause per line.

  1. Paste your content

    Paste the SQL query.

  2. Format

    Automatic indentation and layout.

  3. Copy the result

    Copy or download the result in one click.

FreeNo subscription, no hidden limits.
No sign-upOpen the page and use the tool. That’s it.
InstantResults in seconds, on mobile too.
PrivateEverything runs in your browser.

About the SQL formatter

A well-formatted query is much easier to reread, debug and share, especially with complex joins.

sql formatter sql beautifier format sql online sql query formatter indent sql pretty print sql sql formatter online free
FAQ

Frequently asked questions about the SQL formatter

Does the formatter run the query?

No. It only formats it.

Which dialects are supported?

Standard SQL syntax, which is compatible for the most part with MySQL, PostgreSQL, SQL Server and SQLite.

Are my queries sent anywhere?

No. The formatting is local.

Do keywords have to be uppercase?

It is not required, but it is a convention that improves readability.

Esc
↑ ↓ navigateEnter open