SQL formatting workflow

Format SQL online in one paste

One-line SQL is impossible to review. The SQL formatter re-indents queries, aligns keywords, and applies consistent casing, so you can read and review them instantly, all locally.

01

The fast workflow

Follow the same short workflow every time so the result is predictable.

1

Paste the query

Drop in the SQL from code, logs, or a database tool.

2

Pick the style

Choose indentation width and keyword casing.

3

Format

The query is re-indented and aligned.

4

Copy or download

Use the formatted query in code or documentation.

02

What the formatter normalizes

The formatter moves each clause to its own line, indents subqueries and JOIN blocks, and aligns commas and operators. The output is deterministic, so the same query formats the same way every time.

For the rules behind readable queries, see the SQL formatting guide.

03

Common problems

  • Reviewing minified SQL line by line
  • Mixed casing that hides keywords
  • Copying formatted SQL from tools that change the query
04

Best practices

  • Format before reviewing, review before running
  • Keep a consistent style across the team
  • Re-run the formatter after editing to keep queries clean
05

Frequently asked questions

Does formatting change what the query does?

No. Formatting only changes whitespace and casing. The parsed structure of the query is untouched.

Can it format stored procedures?

Common procedural SQL is supported; very complex dialect-specific syntax may need manual touches afterward.

Does it support MySQL, PostgreSQL, and SQL Server?

The formatter handles the standard syntax shared by the major dialects, with options for common differences.

Is my query uploaded?

No. Formatting runs locally in your browser.

06

Your data stays local

Everything runs in your browser. Files and values are never uploaded or stored.

Open SQL Formatter