FormatterNew

SQL Formatter with Uppercase Keywords

Format and beautify SQL queries with proper indentation

100% client-side — your data never leaves your browserNo data stored or uploadedFree for lifetime · No signup

What is a SQL formatter?

A SQL formatter takes a query that has collapsed into one long line — copied from application logs, an ORM's debug output, or a slow-query report — and lays it out with each major clause (SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY) on its own line, with keywords uppercased for consistency. The structure of the query becomes visible: what's being selected, which tables are joined, and where the filtering happens.

Formatting runs entirely in your browser. Queries often embed real data in their literals — customer emails, IDs, internal table names — and none of it is uploaded, stored, or logged here.

When to use it

The most frequent trigger is a query you didn't write: an ORM-generated statement from Hibernate or Prisma logs, a query captured in a slow-query log, or a monster SELECT a teammate pasted into chat. Formatting it is the first step of understanding it — you can't reason about join order or spot a missing WHERE condition in a 400-character line.

It's also useful before committing: raw SQL in migrations, report definitions, and analytics notebooks lives longer than most application code, and consistent clause-per-line layout with uppercase keywords makes future diffs reviewable. When a code review comment says "what does this query actually do?", pasting a formatted version — or better, the permalink that reproduces it — usually answers the question.

Example

Paste select u.name, count(o.id) from users u left join orders o on o.user_id = u.id where u.active = 1 group by u.name order by 2 desc and Format returns it with SELECT, FROM, LEFT JOIN, WHERE, GROUP BY and ORDER BY each starting a new line, keywords uppercased. The reshaped query makes it obvious at a glance that this is a per-user order count over active users. Use "Copy link to this result" to share a permalink that restores the exact query for whoever opens it — handy in code reviews and bug reports.

How to use the SQL Formatter with Uppercase Keywords tool

  1. 1

    Paste your SQL

    One-liners from logs, ORM debug output, or hand-written queries all work.

  2. 2

    Format

    Major clauses move to their own lines and keywords are uppercased, all locally in your browser.

  3. 3

    Copy or share

    Copy the formatted query, or copy a permalink that restores your exact input for anyone who opens it.

Frequently asked questions

Are my queries sent to a server?

No. Formatting is pure client-side JavaScript — the query never leaves your browser, which matters because production queries routinely contain real customer data in their literals.

Which SQL dialects are supported?

The formatter works on the shared core of standard SQL — SELECT/INSERT/UPDATE/DELETE, joins, grouping, CTEs via WITH — so queries for PostgreSQL, MySQL, SQL Server, and SQLite all format sensibly. It doesn't parse vendor-specific procedural extensions like PL/pgSQL or T-SQL control flow.

Does formatting change what the query does?

No. Only whitespace and keyword casing change; identifiers, literals, and clause order are untouched. SQL ignores insignificant whitespace, so the formatted query executes identically.

Why did my keyword-named column get uppercased?

Keyword casing is applied by word matching, so an identifier that collides with a SQL keyword — a column named order, count, or values — will be uppercased along with the real keywords. Since SQL identifiers are case-insensitive unless quoted at creation time, the query still runs; adjust the casing back by hand if the style matters.

Related on TechLogHub

Get the next tool before you need it

One email a week: new and trending developer tools, fresh comparisons, and what shipped. Unsubscribe in one click.