SQL Formatter — Indentation, Keyword Case and Compact Output

Format standard SQL with configurable indentation and keyword case, or compact whitespace while retaining quoted values and comments.

🔒 Local processing
⚡ Free to use
🌐 Runs in your browser
📦 See output options
⚡

SQL Formatter — Indentation, Keyword Case and Compact Output

Tool workspace

Ready

Loading tool...

  1. Paste SQL up to 1,000,000 UTF-16 units.
  2. Select indentation and keyword case.
  3. Choose Format or Minify.
  4. Review the result and test it in your target database before copying.

Format SQL source

The formatter uses a standard SQL parser to distinguish keywords, quoted values and comments. Choose two or four spaces or tabs, and upper, lower or preserved keyword case. The tool never executes queries or connects to a database.

Compact mode

Minify reduces whitespace between tokens while retaining string contents and comments. Line comments keep the newline they need. It does not promise the smallest possible query, and comments are not removed. Size counters use UTF-8 bytes.

Compatibility limits

The selected dialect is standard SQL. Vendor extensions, stored procedures or alternate statement delimiters may fail; an error is preferable to rewriting unknown syntax. The input limit is 1,000,000 UTF-16 units. Formatting is not query validation, optimization or a security review. The engine loads from this site; see the privacy policy for shared services.

Frequently asked questions

Does it run SQL?

No, it transforms source text without a database connection.

Does Minify remove comments?

No. It conservatively compacts whitespace and preserves comments.

Does it support every SQL dialect?

No. This interface uses standard SQL; vendor-specific syntax can be rejected.