Formatador SQL

Formate e embeleze consultas SQL com suporte a dialetos

Input

Loading editor...

Formatted Output

Loading editor...

Make complex SQL queries readable in seconds

Long SQL queries — multiple JOINs, CTEs, nested subqueries, window functions — quickly become unreadable when written on a few long lines. A formatter inserts line breaks, indents subqueries, and aligns clauses so you can review logic, debug joins, or share queries in tickets without losing your mind.

Use the formatter when you need to

Review a complex analytical query

Format a multi-CTE query so each step's logic is visible without horizontal scrolling.

Document SQL in a runbook or ticket

Clean up the query so future readers can scan it without replaying the whole thing in their head.

Debug a slow query

Format before reading EXPLAIN output so the structure of the query is clear to compare against the plan.

How to format SQL quickly

  1. 1

    Paste your query into the editor.

  2. 2

    Pick a SQL dialect if needed (PostgreSQL, MySQL, SQL Server, etc.).

  3. 3

    Click Format and copy the indented result.

Common SQL-formatting workflows

Hand off a query to a teammate

Format before pasting into a ticket so the reviewer can read the logic in seconds.

Clean up a generated query

ORM-generated SQL is often long and dense — format to confirm what actually runs.

Build a runbook entry

Document a recovery query so the next on-caller can read and adapt it under pressure.

Ferramentas relacionadas

Perguntas frequentes

The formatter handles standard SQL plus dialect-specific syntax for PostgreSQL, MySQL, SQL Server, SQLite, BigQuery, and Snowflake. Choose the dialect that matches your database for the most accurate formatting.

No. Formatting only changes whitespace and line breaks. The query that runs is identical — only readability changes. Comments, hints, and dialect-specific syntax are preserved.

Yes. Common Table Expressions (WITH clauses), window functions (OVER, PARTITION BY), and recursive CTEs format with appropriate indentation so each clause's logic is easy to follow.

The formatter targets queries (SELECT, INSERT, UPDATE, DELETE, CREATE, etc.). Stored procedure bodies with control flow (IF, WHILE, BEGIN/END) format reasonably for most dialects but may need manual cleanup for complex procedural code.

No. Formatting happens entirely in your browser. Your SQL — including any sensitive table or column names — never leaves your machine.