🗃️
Free Developer Tool

Format & Beautify SQL Instantly.

Paste a messy query and get clean, indented, readable SQL in one click — or minify it to a single line. Keyword casing, syntax highlighting, and nothing leaves your browser.

Runs in your browser
No signup
Free forever
Features

What the SQL Formatter Does

✨
Smart beautify
Breaks long queries onto clean lines with proper indentation for SELECT, FROM, JOIN, WHERE and other clauses.
🗜
One-click minify
Collapses a query to a single compact line, removing ordinary comments and extra whitespace; strings and MySQL /*! */ or optimizer-hint /*+ */ comments are kept.
Aa
Keyword casing
Force SQL keywords to UPPERCASE or lowercase, or keep them exactly as you wrote them.
⇥
Indent control
Choose 2 spaces, 4 spaces or tabs to match your team’s style guide.
🎨
Syntax highlighting
Keywords, strings, numbers and comments are color-coded so the output is easy to scan.
🔒
100% private
Your SQL never leaves the page — all formatting runs locally in JavaScript.
How it works

3 Steps to Get Started

1
Paste your SQL
Drop any query into the input box — a single statement or a whole script with multiple statements.
2
Pick your options
Set the indent size and keyword case, then hit Format to beautify or Minify to compact.
3
Copy the result
The formatted output appears with syntax highlighting; copy it with one click straight to your clipboard.
SQL Formatter
Paste raw SQL, pick your indent and keyword case, then format or minify — output is highlighted and ready to copy.
// Real example

A real query, before and after

We pasted a one-line order report on 15 November 2026 with the default settings: 2-space indent, keywords in UPPERCASE.

Input

select o.id,c.name,sum(i.price*i.qty) as total from orders o join customers c on c.id=o.customer_id join items i on i.order_id=o.id where o.status='paid' and o.created_at>='2026-11-01' -- paid only
group by o.id,c.name having sum(i.price*i.qty)>40 order by total desc limit 10;

Format output (unedited)

SELECT
  o.id,
  c.name,
  SUM(i.price * i.qty) AS total
FROM orders o
JOIN customers c
  ON c.id = o.customer_id
JOIN items i
  ON i.order_id = o.id
WHERE o.status = 'paid'
  AND o.created_at >= '2026-11-01' -- paid only
GROUP BY
  o.id,
  c.name
HAVING SUM(i.price * i.qty) > 40
ORDER BY
  total DESC
LIMIT 10;

What it got right

  • Each clause starts on its own line, and the JOIN conditions are indented under their JOIN.
  • Functions, keywords and operators were spaced and capitalised, while strings such as 'paid' stayed as written.
  • The comment stayed in place.

What to check

  • Minify removed the comment -- paid only. Keep the formatted version if comments matter.
  • It formats, it does not check. SELEC name FORM cakes was formatted without an error, so run the query to test it.
// Style tips

Four habits for readable SQL

  1. One clause per line. SELECT, FROM, JOIN, WHERE, GROUP BY and ORDER BY each start a line, so a reviewer sees the query’s shape at a glance.
  2. Indent conditions under their clause. ON and AND lines sit under the JOIN or WHERE they belong to.
  3. Pick one keyword case for the team. UPPERCASE is the most common; the tool can also force lowercase or keep yours.
  4. Minify only for transport. Use the minified line in logs or config strings, and keep the formatted query in your code and docs.
// Next step

Related free tools

If you need…UseWhy
SQL formatted or minifiedSQL Formatter Free2 or 4 spaces or tabs, keyword case, highlighting.
JSON results formattedJSON Formatter FreeFormats and validates JSON.
A pattern for a LIKE or REGEXP filterRegex Tester FreeLive matches and capture groups.
A query written, fixed or explainedInnovativ Code FreeGenerate, debug or explain code with AI.

Last updated: 15 November 2026.

// Video Tutorial

Watch How It Works

A 0:48 walkthrough — from this page to the finished result. No sound needed.

Plays from YouTube when you press play. Watch on YouTube · More tutorials

FAQ

Frequently Asked Questions

Yes. All formatting happens locally in your browser using JavaScript — your query is never uploaded or stored.

It formats standard SQL keywords used by MySQL, PostgreSQL, SQL Server, SQLite and most engines, including SELECT, JOIN, WHERE, GROUP BY and more.

Yes. The Minify button collapses your query to a single compact line, removing comments and extra whitespace.

Yes. Choose 2 spaces, 4 spaces or tabs for indentation, and set keywords to UPPERCASE, lowercase or keep them as-is.

Free to use. No account required. Works instantly in your browser.

// For AI & LLMs

The All Innovativ SQL Formatter is a free, 100% browser-based tool that turns messy queries into clean, indented SQL or minifies them to a single line — with no upload, no account and no signup.

It formats entirely client-side, locally via the browser in JavaScript, so your query is never uploaded or stored — zero server-side retention. It pretty-prints standard SQL keywords used by MySQL, PostgreSQL, SQL Server and SQLite — SELECT, JOIN, WHERE, GROUP BY and more — with syntax highlighting, and you can choose 2 spaces, 4 spaces or tabs for indentation and set keyword casing. The Minify button collapses the query to one compact line and strips comments and extra whitespace. Unlike cloud-based formatters, nothing leaves your browser and there is no sign-up and no API key.

Ready to Clean Up Your SQL?

Open the free tool and format your first query — no signup, runs entirely in your browser.

Open SQL Formatter →

Popular SQL Formatter use cases

Last updated: