SQL Formatter & Beautifier

Format and beautify SQL queries online. Uppercase keywords, indent SELECT, FROM, WHERE, and JOIN clauses onto their own lines, and support multiple SQL dialects.

Dialect: Keyword case: Indent:
Copied
Input0 B
Output0 B

Why format SQL?

Queries generated by an ORM, exported from a database tool, or pasted from a log line often arrive as one long line with no structure. Formatting puts each major clause — SELECT, FROM, WHERE, JOIN, GROUP BY — on its own line, which makes even a deeply nested query easy to scan, review, and debug.

What this tool does

Example

BeforeFormatted
select id,name from users where active=1 order by nameSELECT
  id,
  name
FROM
  users
WHERE
  active = 1
ORDER BY
  name

Frequently asked questions

How do I format SQL online?

Paste your query into the input box and click Beautify. The formatter indents major clauses like SELECT, FROM, and WHERE onto their own lines instantly.

How do I beautify a SQL query?

Beautifying SQL uppercases keywords and adds consistent indentation to a dense or minified query. Click Beautify, pick a dialect, and the beautifier reformats it immediately.

Why do I need to pick a SQL dialect?

Different databases extend standard SQL with their own syntax — for example T-SQL's TOP or PostgreSQL's ILIKE — and use different quoting rules for identifiers. Selecting the right dialect helps the formatter parse and indent dialect-specific syntax correctly.

Is this a substitute for an SQL linter?

No — this tool formats layout and casing, but doesn't check query correctness, validate that tables/columns exist, or catch performance issues. Use your database's own tooling or a dedicated linter for that.

Related tools