FluentDBFluentDB
Free tool

SQL Formatter

Paste messy SQL, get clean, readable SQL. A free formatter and beautifier for PostgreSQL, MySQL, SQL Server, and more, that runs entirely in your browser.

By Kevin Piacentini, Software Engineer & Founder of FluentDB
Your SQL
Formatted
SELECT
  u.id,
  u.name,
  count(o.id) AS orders
FROM
  users u
  LEFT JOIN orders o ON o.user_id = u.id
WHERE
  u.created_at > '2024-01-01'
GROUP BY
  u.id,
  u.name
HAVING
  count(o.id) > 3
ORDER BY
  orders DESC
LIMIT
  10;

Runs entirely in your browser. Your SQL never leaves your machine, and nothing is sent to a server.

How to format your SQL

  1. 1Paste or type your SQL into the editor on the left.
  2. 2Pick your dialect (PostgreSQL, MySQL, SQL Server, SQLite, and more) and your formatting options: indent size and keyword case.
  3. 3Read or copy the formatted SQL on the right. Everything runs in your browser, so nothing is ever sent to a server.

The options, explained

Dialect

Formatting rules differ by database. Pick PostgreSQL, MySQL, SQL Server (T-SQL), SQLite, BigQuery, or standard SQL so identifiers, functions, and syntax are treated correctly for your engine.

Indentation

Choose 2 spaces, 4 spaces, or tabs. Match your team's style so the formatted output drops cleanly into your codebase and version control.

Keyword case

Uppercase keywords (SELECT, FROM, WHERE) are the most common convention and make the shape of a query easy to scan. Lowercase and preserve are there if your house style differs.

Why format SQL at all

Consistent formatting is not cosmetic. It makes queries reviewable, makes diffs show only what actually changed, and ends the small arguments about whitespace. A few conventions go a long way:

  • Uppercase keywords so the structure of a query is obvious at a glance.
  • One column, join, or condition per line, so a code-review diff shows exactly what changed.
  • Consistent indentation for subqueries and CTEs, so nesting is readable instead of a wall of text.
  • A consistent style across the team, so nobody wastes a review arguing about whitespace.

Format and run SQL in a real client

This tool formats text. FluentDB, the native macOS database client, formats your SQL as you write it, runs it against your real schema, and has an AI co-pilot that writes it for you.

Download FluentDB for Mac

SQL formatter FAQ

Is this SQL formatter private? Does it send my SQL anywhere?

No. The formatter runs entirely in your browser using JavaScript. Your SQL is never uploaded or sent to any server, which is not true of many online formatters. You can even use it offline once the page has loaded.

Which SQL dialects does it support?

PostgreSQL, MySQL, SQL Server (T-SQL), SQLite, BigQuery, and standard SQL. Pick the dialect that matches your database so formatting is correct for your engine.

Does it run my SQL or connect to a database?

No. It only reformats the text of your query. It never executes anything and never connects to a database, so it is completely safe to paste production queries.

Is it free?

Yes, the formatter is free to use with no limits and no account. It is made by FluentDB, the native macOS database client, which formats and runs SQL for you inside a real app.

What is the difference between a SQL formatter and a beautifier?

They are the same thing: both take messy or minified SQL and lay it out with consistent indentation, line breaks, and keyword case so it is readable. This tool does exactly that.