My Tools Garage

SQL Formatter

Pretty-print messy SQL into readable queries.

in-browser

How to use

  1. 1 Paste your SQL query into the input box.
  2. 2 Choose a keyword case: uppercase, lowercase or preserve.
  3. 3 Set the indent size in spaces.
  4. 4 Copy the formatted query from the output panel.

About SQL Formatter

The SQL Formatter takes a cramped, single-line or inconsistently indented query and rewrites it into clean, readable SQL.

Queries copied out of code, logs or an ORM often arrive as one long string, which makes them painful to read and review.

This formatter breaks the statement onto sensible lines — each major clause such as SELECT, FROM, WHERE, JOIN, GROUP BY and ORDER BY starts a fresh line — and indents boolean conditions joined by AND or OR so the logic of a WHERE clause is obvious at a glance.

You control two things.

Keyword case lets you force recognised SQL keywords to uppercase (the classic convention), lowercase, or leave them exactly as written, while your table and column names are never touched.

The indent setting chooses how many spaces each level uses, from a tight zero up to eight.

The formatter is comment- and string-aware: text inside single quotes, double quotes or backticks is preserved verbatim, and both line comments (--) and block comments (/* … */) survive intact, so a word like “from” sitting inside a string literal will never be mistaken for the FROM clause.

It is a formatter rather than a validator, so it makes existing SQL pretty without trying to check or execute it.

Everything runs in your browser — no query is uploaded or logged — making it safe for queries that touch sensitive schemas, and it keeps working offline.

FAQ

Does it validate or run my SQL?

No. It only reformats existing SQL for readability. It never connects to a database, executes the query or checks it for errors.

Will it change my table and column names?

No. Only recognised SQL keywords are case-normalised. Identifiers, string literals and comments are preserved exactly as you wrote them.

Is it safe for queries against sensitive data?

Yes. The formatting happens entirely in your browser; nothing is uploaded, logged or stored, so private schemas never leave your machine.