Developer Utility

SQL Formatter

SQL

Format SQL queries with dialect and indentation support

Your data is processed locally in your browser. Nothing is uploaded.

What is SQL Formatter?

SQL queries are often generated as a single compressed line by ORMs and logging tools, which makes them painful to read and debug. This formatter re-indents your query into a consistent layout and understands PostgreSQL, MySQL, SQLite and Transact-SQL dialects, with configurable indentation.

How to use

  1. Paste your SQL into the input pane.
  2. Select the dialect that matches your database.
  3. Choose a 2-space, 4-space or tab indentation.
  4. Click Format and copy the reformatted query.

Use Cases

  • Reading queries generated by ORMs, migrations or query builders.
  • Enforcing a consistent SQL style across a team's codebase.
  • Untangling a complex query with multiple joins before refactoring it.

Related Tools