Make SQL queries readable or minify them to one line, for Standard SQL, MySQL, PostgreSQL and Transact-SQL.
About the SQL Formatter
Beautifies or minifies SQL queries and highlights syntax errors. It supports Standard SQL, MySQL, PostgreSQL and Transact-SQL (T-SQL), and can set keyword case (for example UPPERCASE).
How to use it
Paste your SQL query.
Choose the dialect: Standard SQL, MySQL, PostgreSQL or Transact-SQL.
Pick UPPERCASE or lowercase keywords and an indent of 2 or 4 spaces.
Click Format to beautify, or Minify to put the query on one line, then copy the result.
Good for
Reading a long one-line query copied from logs
Standardizing query style before a code review
Spotting a missing comma or bracket
Tip: Pick the dialect that matches your database; functions and quoting rules differ between MySQL, PostgreSQL and SQL Server.
Frequently asked questions
Which SQL dialects are supported?
Standard SQL, MySQL, PostgreSQL and Transact-SQL (SQL Server).
Does minifying change my string values?
No. Text inside quotes is kept exactly as written, and -- comments are turned into /* */ comments so they cannot hide the rest of the query.
Does it run the query?
No. It only formats the text; nothing is sent to a database.