SQL FORMATTER / 14 DIALECTS

SQL Formatter

Turn a one-line query into a structure you can read at a glance.

Runs locally · code is not uploaded
Options

YOUR NEXT STEP

Connect useful tools with your company workflow

Create a company account to configure website monitoring, business email and notifications, and invite your team to work together.

New companies receive a 14-day Pro trial, with no card required. Trials exclude the paid monthly credit grant.

Already have an account? Open your workspace →

How to use it

  1. Paste code, drop a file or load the sample; the language is preset for this page and can be changed.
  2. Choose format or minify and adjust indent, width and other options; the result appears on the right as you type.
  3. Copy or download the result; on an error, use "Go to error", fix it and run again.

SQL dialects and keyword case

Databases differ: MySQL uses backticks, SQL Server square brackets, PostgreSQL :: casts. Pick the right dialect so these parse correctly; upper-case keywords are the most common convention, or keep them as written.

Supported dialects
DialectTypical syntax
MySQL / MariaDB`table`, LIMIT 10
PostgreSQLvalue::int, RETURNING *
SQL Server (T-SQL)[table], TOP 10
Oracle PL/SQLNVL(), ROWNUM
BigQuery`project.dataset.table`
SQLite / Snowflake / Redshift / Spark / Hive / Trino / Db2Their own functions and keywords

Languages and engines

Formatting uses the same open-source engines as popular editors, so results match Prettier in VS Code and your team can keep one style. Every engine loads from this site and runs in your browser.

Language
LanguageFormatCompress
HTMLPrettier 3✓ comments and whitespace
XMLXunL XML engine✓
CSS / SCSS / LessPrettier 3✓ CSSO restructuring
JavaScript / TypeScriptPrettier 3(Babel)✓ Terser (JavaScript only)
JSONPrettier 3✓ big numbers keep precision
YAMLPrettier 3— (comments kept)
SQLsql-formatter (14 dialects)—

Frequently asked questions

Why choose a dialect?

Databases quote identifiers and name functions differently, such as MySQL backticks, SQL Server brackets and PostgreSQL :: casts. The right dialect parses them correctly; the wrong one may error or split them oddly.

Can formatting change query results?

No, only whitespace, line breaks and keyword case change; strings and quoted identifiers are untouched. Still run it once on a test database before production.

Is my code uploaded?

No. The engines download from this site and run in your browser; your code never passes through our servers or any third party, so it is safe for internal code and configuration.

How large can files be?

Up to 5 MB per file; above 300 KB the page waits for the button instead of formatting as you type, to keep the browser responsive.

SQL formatter practical guide and common questions

What does a SQL formatter do?

Built on open-source sql-formatter 15, SQL is parsed in the chosen dialect: each clause (SELECT, FROM, WHERE, GROUP BY…) on its own line, columns and conditions indented one per line, and keyword, data type and function case unified.

Who is this for, and when is it useful?

Developers, analysts and DBAs writing reports, tuning slow queries or reviewing code who need a one-line or ORM-printed query to be readable.

How do I use this SQL formatter?

Choose the dialect and keyword case, paste SQL and get one clause per line and one column per line, with multiple statements separated.

How should I interpret the results?

Only whitespace and case change; meaning is not rewritten and tables or columns are not checked. Stored procedures and rare dialect extensions may not parse; try Standard SQL if one fails.

Where is the work performed, and which services receive data?

SQL is formatted locally; nothing connects to a database and queries are never uploaded.