Free tool

SQL Formatter

Format and beautify your SQL queries with clean indentation. MySQL, PostgreSQL, SQLite, SQL Server and BigQuery. 100% in your browser.

Dialect

Built by

Miguel Ángel Colorado Marin (MACM)

Full-Stack Developer · Guadalajara, España

I develop web apps, digital tools and full projects — from design to deployment.

Contact me

How to format a SQL query?

  1. 1

    Choose the dialect

    Select your database engine: standard, MySQL, PostgreSQL, SQLite, SQL Server or BigQuery.

  2. 2

    Paste your SQL

    Paste the unformatted query into the left box, however minified or messy it is.

  3. 3

    Format

    Click Format and you'll get the SQL with line breaks, indentation and uppercase keywords.

  4. 4

    Copy

    Copy the formatted SQL to clipboard, ready for your editor or documentation.

Frequently asked questions

Is my SQL sent to a server?

No. Formatting happens 100% in your browser. Your query never leaves your device, ideal for SQL with sensitive data.

Which dialects are supported?

Standard SQL, MySQL, PostgreSQL, SQLite, Transact-SQL (SQL Server) and BigQuery, each with its syntax particularities.

Does it change my query?

No. It only reorganizes the formatting (spaces, line breaks, uppercase keywords). The query logic is exactly the same.

Does it work for minified one-line SQL?

Yes. It takes any query, whether on one line or unordered, and makes it readable with the correct structure.

Related tools

Embed SQL Formatter on your site

Add SQL Formatter to any web page with a simple iframe. Free, with attribution to miguelacm.es.

<iframe
  src="https://miguelacm.es/embed/sql-formatter"
  width="100%"
  height="700"
  frameborder="0"
  title="SQL Formatter — miguelacm.es"
></iframe>
View embed in new tab →