SQL Formatter

SQL Formatter

Pretty-print SQL with clauses on their own lines. The result updates as you type.

Free
No signup
Instant
Private
Input
0 words • 0 characters • 0 without spaces • 0 lines
Convert to
Output
0 words • 0 characters • 0 without spaces • 0 lines

Private by design

This conversion runs entirely in your browser. Your text is not sent to a server.

Tip

SQL formatting only rewrites whitespace and keyword layout. XML must be well-formed or you will see an error.

How to convert with SQL Formatter

  1. Paste a SQL query or XML document.

  2. The formatted result updates as you type — nothing is uploaded.

  3. Use Convert to to switch between SQL and XML formatters.

  4. Copy the result. Nothing is executed against a database.

When should you use it?

  • SQL

    Put clauses on their own lines so a long query is readable.

  • XML

    Pretty-print a document before you inspect or convert it.

  • Review

    Format locally before you paste into a ticket or review.

  • Stays here

    Queries and documents never leave this tab.

Your text stays private.

SQL and XML formatting run entirely in your browser.

Learn more about privacy →

About formatting SQL and XML in the browser

SQL Formatter rewrites whitespace and keyword layout so SELECT / FROM / WHERE are readable. It does not execute the query and does not talk to a database. XML Formatter indents well-formed documents; malformed XML shows an error instead of inventing tags. Convert to switches between SQL and XML formatters.

Worked example: a one-line SELECT with several JOINs becomes clauses on their own lines. A nested XML config becomes an indented tree. This is not a SQL dialect validator and not an XML schema checker.

Related: XML ↔ JSON when you need objects, YAML ↔ JSON for configs, JSON Formatter for JSON. Nothing is uploaded. Keep production queries and documents off shared machines.

Related developer tools

SQL Formatter examples

Query

Input
select id, name from users where active = 1 order by name;
Output
SELECT id, name FROM users WHERE active = 1 ORDER BY name;

SQL and XML

ToolExampleTypical use
SQLSELECT … FROM …Read SELECT / FROM / WHERE clauses
XML<note>…</note>Indent nested elements

SQL Formatter FAQ

Yes. Paste a query into SQL Formatter. Clauses like SELECT, FROM, and WHERE indent locally as you type. Export saves a .sql file.

It only rewrites whitespace and keyword casing for readability. It does not execute SQL or connect to a database.