JSON Parser

SQL Formatter & Beautifier Online

Format messy SQL into readable, consistently indented queries with uppercase keywords, or minify it to a single compact line. It supports Standard SQL, PostgreSQL, MySQL, SQLite, SQL Server and BigQuery, and runs in your browser.

How to format or minify SQL

  1. Paste your SQL into the Input box.
  2. Choose Beautify for readable output or Minify for the smallest output. The result updates as you type.
  3. Click Copy to copy it. In Minify mode the badge shows how much smaller the output is.

Example

Input SQL

select u.id, u.name, count(o.id) as orders from users u left join orders o on o.user_id = u.id where u.active = true group by u.id, u.name order by orders desc limit 10;

Beautified

SELECT
  u.id,
  u.name,
  count(o.id) AS orders
FROM
  users u
  LEFT JOIN orders o ON o.user_id = u.id
WHERE
  u.active = TRUE
GROUP BY
  u.id,
  u.name
ORDER BY
  orders DESC
LIMIT
  10;

Same input

select u.id, u.name, count(o.id) as orders from users u left join orders o on o.user_id = u.id where u.active = true group by u.id, u.name order by orders desc limit 10;

Minified

select u.id,u.name,count(o.id)as orders from users u left join orders o on o.user_id = u.id where u.active = true group by u.id,u.name order by orders desc limit 10;

Tips

  • Pick your database in the dropdown so dialect-specific syntax is formatted correctly.
  • Choose 2 spaces, 4 spaces or tabs for indentation.
  • Minify strips comments and collapses whitespace but leaves string literals untouched.

Related tools

Generate tables with JSON to SQL, compare two queries with the text diff checker, or tidy other code with the JS and CSS formatters.

Frequently asked questions

How do I format a SQL query online?
Paste your query into the input box and the formatted SQL appears instantly: keywords are uppercased and each clause goes on its own line with consistent indentation. Pick your database from the dropdown for dialect-specific syntax.
Which SQL dialects are supported?
Standard SQL, PostgreSQL, MySQL, SQLite, SQL Server (T-SQL) and BigQuery. Choosing the right dialect makes sure dialect-specific operators and quoting are formatted correctly.
Can I minify SQL?
Yes. Switch to Minify to strip comments and collapse whitespace into a compact single-line query. String literals are left untouched. Everything runs in your browser — your code is never uploaded to a server.
Handles JSON files up to 20MB smoothly