SQL Formatter

Beautify, format, and minify SQL queries. Instant client-side formatting.

Input chars: 0
Output chars: 0
Lines: 0
Keywords: 0

SQL · format · beautify · minify

Pretty-print messy SQL into readable clauses, or minify a query into a compact line — entirely in your browser. Paste a long SELECT from a log or ORM dump, format it, and copy it back into your editor without uploading query text to a third-party server.

Beautify & minify Client-side only Copy-ready output No sign-up Works offline once loaded

What this tool does

SQL is easier to review when keywords, joins, and nested subqueries are indented consistently. Production logs and APM tools often emit single-line queries that are painful to read. This formatter rewrites whitespace for human scanning and can compress formatted SQL back down when you need a single line for a ticket or config field.

Formatting does not execute SQL against a database. It does not validate dialect-specific grammar for Postgres vs MySQL vs SQL Server. Treat output as a readability aid, then run EXPLAIN and tests in your real engine.

How to use it

  1. Paste a query into the input area.
  2. Click Beautify for indented output or Minify for a compact line.
  3. Copy the result into your SQL client, migration, or code review comment.
  4. Clear when switching between unrelated queries to avoid mix-ups.

When a browser SQL formatter helps

Example

SELECT u.name, o.total FROM users u JOIN orders o ON u.id = o.user_id WHERE o.created_at > '2024-01-01' ORDER BY o.total DESC LIMIT 10;

Beautified layout typically separates SELECT lists, JOIN lines, and ORDER BY so each clause is scannable. Exact indentation depends on the formatter rules on this page.

Dialect tip: Identifiers, quoting (" vs `), and functions differ across engines. Formatting whitespace is portable; copying a MySQL-only function into Postgres still fails at runtime.

Limitations

FAQ

Does this run my query?

No. It only reformats text. Connect to your database with a real client to execute.

Will formatting change query meaning?

Whitespace outside string literals should not change semantics. Always re-check string contents and comments if something looks off.

Is my SQL uploaded?

No — processing is local in the browser. Privacy Policy.

Related tools

Sponsored