SQL Formatter & Minifier
Beautify or minify SQL for PostgreSQL, MySQL, SQLite, BigQuery, T-SQL and more — with keyword casing and indent control. Runs in your browser; nothing is uploaded.
A SQL formatter reflows a query so each clause sits on its own line with consistent indentation and, optionally, uppercased keywords — making long SELECTs far easier to read and review. Pick your dialect so the formatter knows that database's keywords, choose the keyword case and indent, then press Format. Minify does the reverse: it collapses the query to a single compact line, dropping comments and extra whitespace while carefully preserving string literals and quoted identifiers. Only whitespace and keyword case change — never your table names, columns, values or logic — so the result always means the same thing. Everything runs in your browser; nothing you paste is uploaded. Working with JSON instead? Try the JSON Formatter.
Frequently Asked Questions
What does a SQL formatter do?
A SQL formatter takes a query written on one line or with inconsistent spacing and rewrites it with clean, standardised layout — each clause on its own line, consistent indentation, aligned columns and lists, and optionally uppercased keywords. It only changes whitespace and the letter case of keywords, never the meaning of the query, so the result runs exactly the same. Formatting makes long queries far easier to read, review and debug, which is why it is a standard step before committing SQL or pasting it into a pull request.
Which SQL dialects are supported?
You can pick the dialect so the formatter understands that database's specific keywords and syntax: Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, BigQuery, Amazon Redshift, Snowflake, Transact-SQL (SQL Server), PL/SQL (Oracle) and Spark SQL. Choosing the right dialect gives the most accurate result because each database has its own reserved words and functions, but Standard SQL is a good default that works well for most everyday queries. The dialect decides which reserved words are recognised and how quoted identifiers are read — Transact-SQL square brackets and BigQuery backticks, for example.
What is the difference between formatting and minifying?
Formatting (beautifying) adds whitespace and line breaks to make a query readable by a person. Minifying does the opposite: it collapses the query onto a single line by removing unnecessary whitespace and stripping comments, producing the most compact form for embedding in code, a config file or a URL. This tool's minifier is aware of string literals and comments, so spaces inside quoted text are preserved and a line comment can never accidentally swallow the rest of the query.
Is my SQL uploaded or stored anywhere?
No — the SQL you paste stays on your device. Everything runs locally in your browser with a self-hosted formatting library — your SQL is never sent to a server, logged or stored. That matters because queries often contain table names, column names and business logic you would not want to paste into a random website. Because it is fully client-side, the tool also keeps working offline once the page has loaded, and closing the tab clears everything.
Will formatting change or break my query?
No — formatting does not change or break your query. The formatter only reflows whitespace and, if you ask it to, changes the case of SQL keywords — it never alters table names, column names, string values or the logic of the statement, so the formatted query is equivalent to what you pasted. String literals and identifiers in quotes are preserved exactly. If the input is not valid SQL the tool still does its best to lay it out and shows an error message when it genuinely cannot parse the text.