gizmobench
BrowseDaily

SQL Formatter

Paste SQL, choose its dialect and read the formatted output beside the input. Select PostgreSQL, MySQL, SQLite, SQL Server, Oracle SQL, Snowflake, BigQuery, IBM Db2 or Spark/Databricks SQL. Keyword casing and two- or four-space indentation control the layout. Minify is a separate output mode that compresses whitespace without discarding comments or optimizer hints. Formatting runs in a local worker; your SQL is never sent for processing. Your input and settings are remembered in browser storage, and Start over clears them.

Formatted

SQL output appears here.

Output
Keywords
Indent

Formatting arranges SQL statements for the selected dialect. It does not execute queries, validate database objects or optimize performance. Stored procedures and client batch directives are outside this formatter’s scope. SQL stays in this browser. Your input and settings are remembered in local browser storage; Start over clears them.

Common questions

How do I beautify or unminify a SQL query?
Paste the query, select its dialect and choose Format. The output separates clauses, indents select lists and nested queries, and supports UPPER, lower or As typed keyword casing. Formatting cannot recover comments or original layout that a previous minifier deleted.
Which dialect should I choose?
Match the database that will run your query. PostgreSQL understands dollar-quoted text, casts and positional parameters; SQL Server recognizes bracketed identifiers and @variables; Oracle SQL recognizes alternative q quotes and bind variables. The dialect choice changes syntax handling, not the database engine: no query is executed.
Does Minify remove comments or change keyword case?
No. Minify collapses runs of whitespace outside quoted values and comments, preserves token boundaries, and keeps comments and keyword case. It deliberately retains optimizer hints and MySQL executable comments. A newline after a line comment, or in a gap after a quoted literal, stays a newline, so compact output is not always a single line.
Can it format a stored procedure, PL/SQL program or a script with GO?
Stored procedures and procedural programs are outside this formatter’s supported scope. Paste ordinary SQL statements separately. SQL Server GO, MySQL DELIMITER and a SQL*Plus slash on its own line are client directives and are refused; they are not portable statement terminators.
Does successfully formatting SQL prove it is valid or optimized?
No. Quoting and formatting syntax errors can produce a useful message, but formatting cannot prove that the query is valid for a particular database version, that its tables and columns exist, or that it performs well. Test the final query against the intended database.
Can I format SQL from a .sql file?
Paste the text from your .sql file into the input. This page formats text, rather than executing the script or connecting to a database. Keep client directives and procedural blocks out of the statement formatter.
Is my SQL uploaded, and is my draft saved?
Processing happens in this browser. The page remembers input and settings in local browser storage, so a later visit can restore your draft. Start over removes those saved values. Blocked browser storage does not stop formatting.

Formats SQL statements for the selected dialect; it does not execute SQL, check database objects, optimize queries or validate a complete SQL grammar. Stored procedures and client batch directives are outside its scope. Minify preserves comments and quoted values and can retain meaningful newlines.