● online

SQL Formatter

Paste a long one-line query and get readable, consistently indented SQL — with your choice of dialect, keyword case and indentation. Minify it again for embedding in code.

Advertisement

How to use the SQL Formatter

  1. Paste your SQL query or script.
  2. Choose the dialect, keyword case and indent size.
  3. Press Format SQL (or Minify) and copy the result.

About the SQL Formatter

Queries copied from logs, ORMs and query builders usually arrive on a single line, which makes joins and conditions hard to review. Formatting puts each clause on its own line, indents subqueries and lines up column lists, so mistakes such as a missing join condition stand out. This tool uses the open-source sql-formatter library, which understands the syntax differences between dialects — backtick quoting in MySQL, square brackets in SQL Server, dollar-quoted strings in PostgreSQL. Your SQL never leaves the browser, so it is safe for queries that contain table names or data you would rather keep private.

Advertisement

Frequently asked questions

Does formatting change what my query does?

No. Only whitespace and, if you choose, keyword case change. The query logic and string values are untouched.

Which SQL dialects are supported?

Standard SQL, MySQL, MariaDB, PostgreSQL, SQL Server (T-SQL), SQLite, Oracle PL/SQL, BigQuery, Snowflake and Redshift.

What if my SQL has a syntax error?

The formatter reports where it got stuck. Choose the correct dialect first — many “errors” are dialect-specific syntax.

Is my SQL sent to a server?

No. Formatting runs in your browser.

Related free tools

← Back to all 150 free online tools

Runs in your browser — what you enter stays on your device. Published .

The Tools Guru Editorial Team

Three front-end engineers and technical writers in Punjab, Pakistan, shipping browser software since 2011. Every formula on this site is implemented from a primary source and checked against an independent reference implementation before release — see our editorial policy. Spotted a wrong number? Tell us and we will reproduce it, usually the same working day.

Advertisement

Explore all 150 free tools

Results filter as you type. Press Control plus K to jump here. Ctrl K
150tools0uploads to servers100%free forever

Trending now

All tools