SQL

SQL Formatter

Pretty-print and organize SQL queries for better readability — with support for several common dialects.

  • MySQL
  • PostgreSQL
  • T-SQL
  • minify
Waiting for input...
query.sql
Input
1
Formatted output

                        
—Input length
—Output length
—Output lines
—Statements
This tool runs entirely in your browser. For the best result, pick the dialect that matches your database.
ABOUT

Format SQL queries with dialect support

Queries copied from an ORM or a log are usually one long line. This tool lays them out according to the dialect (MySQL, PostgreSQL, T-SQL and more), normalises keyword case and can collapse a query back to one line. Handy for code review and for documenting complex queries.

HOW TO

How to use it

  1. Paste the query.
  2. Pick your database dialect.
  3. Copy the formatted result, or minify it for embedding in code.
FAQ

Frequently asked questions

Does formatting change what the query does?
No — only whitespace, line breaks and keyword case change. Execution is identical.
Is my query stored on a server?
No, formatting happens in your browser.