SQL Formatter for MySQL, PostgreSQL, SQL Server, SQLite, Oracle, and more. Beautify or minify SQL queries, customize indentation, keyword case, and dialect. All in your browser. Recent queries, shareable links, and dark mode. Free, private, no signup.
`table_name`), supports LIMIT offset, count syntax, and has its own set of string functions. Choose MySQL when working with a MySQL or MariaDB database.
::type casts, RETURNING clauses, JSONB operators (->, ->>, #>), and window functions. Choose PostgreSQL when working with a PostgreSQL database or any derivative (Supabase, Neon, CockroachDB).
[bracket] identifiers, TOP n instead of LIMIT, and GO batch separators. Choose T-SQL when working with SQL Server, Azure SQL, or Synapse.
ROWNUM instead of LIMIT, and has distinctive data types like NUMBER and VARCHAR2. Choose PL/SQL when working with Oracle Database.
Tabular left aligns top-level clauses at the left, with content left-aligned under each keyword.
Tabular right aligns top-level clauses at the left, with content right-aligned under each keyword. Both tabular styles are preferred by data engineers working with wide queries.
Tip: press ⌘/Ctrl + Enter inside the SQL input to format.
⚠️ Sharing a link places your SQL in the URL. Avoid sharing production queries that contain sensitive table names or business logic.
A 50-line SQL query on one line is impossible to review
You know the query works. You tested it. Now you need to paste it into a pull request.
Nobody can read it. Joins wrap around the screen. The WHERE clause is a wall of AND conditions. The reviewer approves without reading.
Formatting fixes that. This tool beautifies SQL across 13 dialects in one click.
Formatting does not change how the query runs
SQL is whitespace-insensitive. The database engine parses SELECT * FROM users identically whether it is on one line or twenty.
Formatting is cosmetic. It changes indentation, line breaks, and keyword case. It never touches string literals, identifiers, or comments.
Zero effect on performance. Zero effect on results. Safe to format any query before running it.
13 dialects. One tool.
MySQL. PostgreSQL. SQL Server (T-SQL). SQLite. Oracle (PL/SQL). MariaDB. BigQuery. Snowflake. Redshift. Spark SQL. Hive. Db2. Standard SQL.
Each dialect has its own keywords and syntax rules. The formatter recognises them all. Choose the dialect that matches your database.
If you are unsure, Standard SQL is a safe default for everyday queries.
Beautify mode
Beautify expands compressed SQL into readable multi-line format. Each top-level clause starts on its own line at the left margin. SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING, LIMIT.
Sub-clauses like JOIN and ON indent one level. AND and OR conditions wrap to their own lines so the logic is visible at a glance.
The formatter respects parentheses, string literals, quoted identifiers, and comments. It handles CASE WHEN blocks, window functions, CTEs, and dialect-specific syntax like PostgreSQL casts and MySQL backticks.
Minify mode
Minify compresses SQL to a single line. It removes comments and collapses whitespace runs.
String literals, quoted identifiers, and dialect-specific syntax stay exactly as written. The result is typically 30% to 70% smaller than the formatted version.
Use minified SQL when embedding queries in application code, JSON payloads, or config files. Do not minify SQL that humans will read or edit.
Formatting options
Keyword case. Uppercase, lowercase, or preserve. Uppercase is the traditional convention. Lowercase is popular in dbt projects.
Tab width. 2, 4, or 8 spaces per indent level.
Indent style. Standard, tabular left, or tabular right. Standard places clauses at the left with content indented. Tabular aligns top-level clauses and their content under each other.
Logical operator newline. Wrap AND and OR at the start of the line or at the end.
Lines between queries. How many blank lines separate multiple statements.
Expression width. The maximum width before long expressions break into multiple lines.
Recent queries and sharing
Every SQL you format or minify is saved to a recent list. Up to 10 entries. Click any chip to reload.
A Share button encodes the current query and dialect settings in the URL. Bookmark it or send it to a teammate. Opening the link restores the exact query and options.
Your dialect, keyword case, indent style, and other preferences are remembered across sessions on your device.
What this tool does not do
It does not validate SQL against a schema. It does not check for syntax errors beyond what the formatter can parse. It does not connect to any database.
It does not store your queries on a server. Everything runs in your browser. Nothing is uploaded, logged, or tracked.
The Share button places the query in the URL. If your SQL contains sensitive table names or business logic, do not share that link publicly.
Privacy and speed
All formatting uses the open-source sql-formatter library. It loads from a public CDN. Your query never leaves your device.
No signup. No account. No ads inside the tool.
Recent queries and preferences are saved in localStorage on your device. Clear your browser data and they are gone.