SQL Formatter

Client-sideNo sign-upFree

Format SQL with capitalized keywords and each major clause on its own line.

How this tool works

1

Paste your SQL

A SELECT, INSERT, UPDATE, or DELETE statement, however it’s currently formatted.

2

Keywords are capitalized

SELECT, FROM, WHERE, JOIN, and other keywords are normalized to uppercase automatically.

3

Clauses break onto their own lines

Each major clause gets its own line with consistent indentation for AND/OR conditions.

4

Copy the readable result

Paste the formatted query into a PR, a code review, or documentation.

Quick facts

Category
Formatters & Beautifiers
Best for
Making a dense one-line query reviewable in a PR
Input
✓ Formatted
Formatted output
SELECT u.id, u.name, o.total FROM users u JOIN orders o ON o.user_id = u.id WHERE o.total > 100 AND u.active = true ORDER BY o.total DESC
8 lines
In-content slot

About this tool

Paste a SQL statement to get consistent keyword capitalization (SELECT, FROM, WHERE, JOIN, and friends are normalized to uppercase regardless of how you typed them) and each major clause - SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY, and more - broken onto its own line, with AND/OR conditions and comma-separated columns indented underneath for readability. The formatter works by pattern-matching common SQL keywords and clause boundaries rather than building a full parse tree of the query, so it handles typical SELECT, INSERT, UPDATE, and DELETE statements well without needing to understand every SQL dialect’s full grammar. That trade-off means unusual constructs - deeply nested subqueries, vendor-specific syntax, or SQL embedded inside strings - may not format exactly as a full SQL-aware formatter would, but for everyday queries it turns a dense one-liner into something reviewable at a glance. Runs entirely client-side.

Why use this tool

Consistent keyword casing

Every SELECT, FROM, and WHERE is capitalized the same way, regardless of how it was typed.

One clause per line

Turns a dense one-liner into a structure you can actually review in a diff.

JOIN and WHERE aware

Handles multi-table queries with JOIN conditions and compound WHERE clauses, not just simple SELECTs.

No dialect lock-in required

Works on standard SQL patterns without needing a specific database engine installed.

Frequently asked questions

Not fully - it recognizes the keywords and clause structure common across standard SQL and the most popular dialects, but it doesn’t parse dialect-specific syntax extensions the way a database engine’s own parser would. Vendor-specific functions and constructs will usually pass through unformatted rather than breaking, but they won’t get special-cased treatment either.

A true parser would need to fully understand every SQL dialect’s grammar to avoid mangling valid queries, which is a much larger undertaking than a free formatting tool needs. Pattern-matching on keywords and clause boundaries covers the vast majority of everyday SELECT/INSERT/UPDATE/DELETE statements well, while staying simple enough to be predictable and fast.

Explore more free tools

Formatters, converters, validators, and generators - all free and running entirely in your browser.

Browse more tools