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

The SQL formatter tidies and beautifies your SQL queries with clean indentation and uppercase keywords, so they're easy to read, review and maintain. It supports the main dialects — MySQL, PostgreSQL, SQLite, SQL Server and BigQuery — so it works with virtually any database. Paste a long, messy query and get a formatted, readable version instantly, ready to copy into your editor or documentation. Formatting SQL saves time when debugging and reduces errors in complex queries with many JOINs and subqueries. All formatting runs locally in your browser: your queries are never uploaded to any server, so you can format SQL with sensitive data without worrying.

Features

  • Multiple SQL dialects
  • Clean indentation
  • Uppercase keywords
  • Copy result
  • 100% in browser

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 →