100% Local — never leaves your browser

SQL Formatter

Format and beautify SQL queries instantly in your browser, with Standard SQL, MySQL, and PostgreSQL dialect support.

Input
Output
Ad slot

How to use this tool

A SQL formatter (or beautifier) takes a SQL query — often written as one dense, hard-to-read line, especially when copied from logs, ORM output, or a minified query builder — and re-indents it with consistent spacing and line breaks around clauses like SELECT, FROM, WHERE, and JOIN. It's useful whenever you need to read, review, or debug a query that isn't formatted for humans.

For example, select id,name from users where active=1 becomes:

select
  id,
  name
from
  users
where
  active = 1

Paste your SQL into the input box on the left, choose the dialect that matches your database, and click Format. The formatted result appears in the output box on the right, and any parse errors are shown below.

FAQ

Is this SQL formatter free to use?

Yes, this tool is completely free to use with no limits on how often you can use it.

Does my SQL get uploaded anywhere?

No. All formatting happens directly in your browser using JavaScript. Your queries — and anything sensitive in them, like table or column names — never leave your computer.

Which SQL dialects are supported?

Standard SQL, MySQL, and PostgreSQL. Each dialect formats certain syntax slightly differently — for example, MySQL's backtick-quoted identifiers or PostgreSQL's array literals — so pick the one that matches the database you're writing for.

Why did formatting fail with a parse error?

This tool formats real SQL — it parses your query to understand its structure before re-indenting it, so it can't format a query that's fundamentally broken (an unclosed quote, an unbalanced parenthesis, etc.). The error message points to the line and column where parsing stopped, which is usually right at or just after the actual mistake.

Related Tools