Shiklo Tools
PDF40
Image20
Calculators & Converters25
Text & Writing13
Developer26
Video14
Audio14
Document14
Data & Spreadsheet12
Web & SEO9
OCR & Scanning5
Archive & File12
Security & Privacy23
Health & Medical29
QR & Barcode5

SQL Formatter

Beautify SQL queries for MySQL, PostgreSQL, SQL Server, Oracle, SQLite, BigQuery, Snowflake and more, or minify them. Private, in your browser.

Paste a long, single-line SQL query and get it back neatly formatted: each clause on its own line, columns and conditions indented, and keywords in the case you prefer. The SQL Formatter understands 13 dialects, including MySQL, PostgreSQL, SQL Server (T-SQL), Oracle PL/SQL, SQLite, BigQuery and Snowflake, so dialect-specific syntax such as backtick names, square brackets, dollar-quoted strings and special operators is handled correctly.

It can also minify SQL into one compact line for embedding in code. The formatting happens in your browser, so queries that contain table names, customer data or business logic are never sent to a server.

How to use SQL Formatter

  1. Paste your SQL, open a .sql file, or click Sample.
  2. Pick your database in Dialect (for example MySQL or PostgreSQL).
  3. Choose keyword case (UPPER, lower or as typed) and the indent: 2, 4 or Tab.
  4. Copy or download the formatted SQL, or click Minify for a single line.

Features

  • 13 SQL dialects: Standard SQL, MySQL, MariaDB, PostgreSQL, SQL Server, Oracle PL/SQL, SQLite, BigQuery, Snowflake, Redshift, Spark, DB2 and Trino.
  • Keywords in UPPER case, lower case, or left as typed.
  • Indent with 2 spaces, 4 spaces or tabs.
  • Multiple statements separated by blank lines.
  • Comments, string literals and quoted names kept exactly.
  • Minify: comments removed and whitespace collapsed outside strings.
  • Live formatting as you type; Ctrl+Enter formats on demand.
  • Private: your queries never leave the browser.

Why format SQL

SQL written by hand, generated by an ORM or copied from a log is often one long line that is hard to read. Formatted SQL puts each clause (SELECT, FROM, JOIN, WHERE, GROUP BY, ORDER BY) at the start of a line and indents the column list and conditions beneath it. That makes it easy to see which tables are joined, which filters apply and where a bracket is missing. Consistent formatting also makes code reviews and version-control diffs much clearer, because a change to one condition shows up as a change to one line.

Choosing the right dialect

Databases share the core of SQL but differ in details: how names are quoted, which operators exist, and how strings and parameters are written. Choosing the matching dialect lets the formatter recognise these details instead of breaking them apart.

DialectTypical syntax it understands
MySQL / MariaDBBacktick names, LIMIT, ON DUPLICATE KEY UPDATE
PostgreSQLDouble-quoted names, :: casts, dollar-quoted strings, RETURNING
SQL Server (T-SQL)Square-bracket names, TOP, @variables, GO batches
Oracle PL/SQLBEGIN … END blocks, :bind variables, CONNECT BY
SQLiteLightweight syntax, ? and :name parameters
BigQueryBacktick project.dataset.table names, STRUCT and ARRAY
Snowflake / RedshiftWarehouse syntax, QUALIFY, semi-structured paths

Keyword case and indentation

Many teams write SQL keywords in upper case (SELECT, WHERE) and names in lower case, so the structure stands out. Others prefer everything in lower case. The Keywords option changes only reserved words; table names, column names and strings are never changed. The indent can be 2 spaces, 4 spaces or a tab, to match your project's style guide or editor.

Minifying SQL

Minify turns a formatted query back into one compact line: comments are removed and runs of spaces and line breaks become a single space, while text inside quotes is kept exactly. That is handy for putting a query into a string in application code, a configuration file or a command line. Formatting the minified query again restores the readable layout.

Is formatting safe?

Formatting only changes whitespace and, if you choose, the letter case of keywords. It never reorders clauses, changes values or alters the meaning of a query, and SQL keywords are case-insensitive in every major database. The tool does not connect to any database and does not run your SQL, so it is safe to use with production queries. It is a formatter, not a full validator: it reports SQL it cannot parse, but a query can be formatted and still fail on the server, for example if a column does not exist.

Frequently asked questions

Is the SQL formatter free and private?

Yes. It is free with no sign-up, and the SQL is formatted in your browser. Your queries are never uploaded or stored.

Which databases are supported?

13 dialects: Standard SQL, MySQL, MariaDB, PostgreSQL, SQL Server (T-SQL), Oracle PL/SQL, SQLite, BigQuery, Snowflake, Redshift, Spark SQL, DB2 and Trino or Presto.

Will formatting change what my query does?

No. Only whitespace and, optionally, the case of keywords change. SQL keywords are not case-sensitive, and names and string values are kept exactly.

Can I format several statements at once?

Yes. Paste a whole script; each statement ending in a semicolon is formatted and separated from the next by a blank line.

Why do I get an error?

The formatter could not parse part of the query, often because a different dialect is selected. Choose the dialect of your database and try again; the message shows where it stopped.

Does it check that tables and columns exist?

No. It does not connect to a database. It formats the text of the query; whether the tables and columns exist is checked by your database when the query runs.

How do I keep my own keyword case?

Set Keywords to “As typed”. The formatter then changes only line breaks and indentation.

Related tools