Skip to main content
{/}codefunc

SQL Formatter

Format SQL queries with proper indentation and line breaks.

About this tool

Format SQL queries with proper indentation and line breaks. Useful when reviewing API responses, cleaning config before commit, or sharing readable snippets in docs and PRs.

Paste a one-line or messy SQL statement into Input. Click Format to break major keywords onto their own lines. Example — Break up a SELECT for review: try `SELECT id, email FROM users WHERE active = 1 ORDER BY created_at DESC` and expect something like `SELECT id, email FROM users WHERE active = 1 ORDER BY created_at DESC`.

This is a lightweight keyword splitter, not a full dialect-aware pretty-printer (Postgres vs MySQL quirks). See also: JSON Formatter. Runs in your browser — nothing you paste gets uploaded.

How to use

  1. Paste a one-line or messy SQL statement into Input.
  2. Click Format to break major keywords onto their own lines.
  3. Copy the result into a PR or query editor for readability.
  4. Re-format after edits so keyword casing stays consistent.

Example

Break up a SELECT for review

Input

SELECT id, email FROM users WHERE active = 1 ORDER BY created_at DESC

Output

SELECT
id, email
FROM
users
WHERE
active = 1
ORDER
BY
created_at DESC

Limitations

  • This is a lightweight keyword splitter, not a full dialect-aware pretty-printer (Postgres vs MySQL quirks).
  • CTEs, window functions, and nested subqueries may not indent as richly as dedicated SQL IDEs.
  • Formatting does not execute or validate SQL against a database.

Related guides

1

Related tools

1

Frequently asked questions

What does the SQL Formatter do?

Format SQL queries with proper indentation and line breaks. Runs in your browser — no install, no account.

How do I use the SQL Formatter?

Paste a one-line or messy SQL statement into Input. Click Format to break major keywords onto their own lines. Copy the result into a PR or query editor for readability. Re-format after edits so keyword casing stays consistent.

Is the SQL Formatter free?

Yes. No signup, no usage limits, no paywall.

Does the SQL Formatter upload my data?

No. Processing happens locally in JavaScript. Your input is not uploaded, stored, or logged.

What are the limitations of the SQL Formatter?

This is a lightweight keyword splitter, not a full dialect-aware pretty-printer (Postgres vs MySQL quirks). CTEs, window functions, and nested subqueries may not indent as richly as dedicated SQL IDEs. Formatting does not execute or validate SQL against a database.

Search tools

Find a developer tool