1. Home
  2. Developer tools
  3. SQL Formatter

SQL Formatter

Turn one-line queries into readable SQL with consistent indentation and keyword case.

Free, no sign-up. Runs in your browser: nothing is uploaded.

Free workspace included. Docs, spreadsheets, notes and tasks that save on your device. No sign-up.Take a look

How to use SQL Formatter

  1. Paste your query.
  2. Pick dialect, keyword case and indentation.
  3. Copy the formatted SQL.

Features

  • Many dialects
  • Keyword case
  • Indentation
  • Several statements at once

Supported formats

You can open

  • SQL

You get

  • SQL

Private by design

Your files are opened and processed by your browser on this device. They are never uploaded to openWorkstand or anyone else, so the SQL Formatter is safe for contracts, IDs, photos and work documents. After you have used it once while online, it also works without an internet connection. How local processing works

Guide

Formatting SQL queries so they're readable and reviewable

SQL copied from logs, ORMs, slow-query reports or monitoring tools usually arrives as one long line. Formatting it puts each clause on its own line, so you can see at a glance what’s selected, joined, filtered and grouped. This formatter understands eleven SQL dialects and runs in your browser.

Formatting a query

  1. Paste a query, or several separated by semicolons. A sample query is loaded to start with.
  2. Choose your dialect: Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift or Spark SQL.
  3. Choose keyword case (UPPER, lower or as typed) and indentation (2 spaces, 4 spaces or tabs).
  4. Copy the result or download it as query.sql.

Your choices are remembered, so the next query is formatted the same way.

Before and after

select id, name, email from customers where country = 'DE' and created_at >= '2026-01-01' order by created_at desc limit 50;

With uppercase keywords and 2-space indentation:

SELECT
  id,
  name,
  email
FROM
  customers
WHERE
  country = 'DE'
  AND created_at >= '2026-01-01'
ORDER BY
  created_at DESC
LIMIT
  50;

Why the dialect matters

Databases disagree on details the formatter needs to understand:

Detail PostgreSQL MySQL SQL Server
Quoting identifiers "name" `name` [name]
Placeholders $1 ? @param
Limiting rows LIMIT 10 LIMIT 10 TOP 10

Snowflake and BigQuery add QUALIFY, Oracle has PL/SQL blocks, and Spark SQL has its own functions. If formatting fails, the dialect is the first thing to check.

Conventions that help in code review

  • One selected column per line, so adding a column is a one-line change in a diff.
  • AND and OR at the start of the line, so conditions line up and are easy to comment out.
  • Consistent keyword case across the project, upper or lower.
  • Explicit JOIN … ON instead of comma joins with conditions in WHERE.
  • Meaningful aliases: orders o is fine; t1, t2 is not.
  • CTEs (WITH … AS) for long queries, so each step has a name.

Comparing two versions

To see what really changed between two versions of a long query, format both with the same settings and compare them with the Diff Checker. Formatting differences disappear and only real changes remain, ideal for reviewing a query change in a pull request or comparing what an ORM generated before and after an update.

What formatting can’t do

The formatter changes layout only. It doesn’t check that tables or columns exist, doesn’t run the query, and can’t tell you whether it’s fast. For performance, use EXPLAIN (or EXPLAIN ANALYZE) in your database, and look for missing indexes, unexpected full scans and joins that multiply rows.

Privacy

Queries can reveal table structures and real values. Everything is formatted in your browser and nothing is sent to a server or any database.

Who formats SQL

  • Developers read queries generated by ORMs and logged by databases.
  • Data analysts tidy long reporting queries before sharing them.
  • Database administrators review slow queries from monitoring tools.
  • Students learn SQL structure and style.

A complete example: reviewing a slow query

  1. Copy the slow query from the database’s slow-query log.
  2. Paste it and choose your database’s dialect.
  3. Read the formatted query: which tables are joined, and what filters are applied.
  4. Run EXPLAIN on it in your database and check whether the filtered columns have indexes.

Tips

  • Format both versions before comparing changes in the Diff Checker.
  • Agree on keyword case and indentation as a team.

Checked against the current version of the SQL Formatter on .

Troubleshooting

It says it could not format the query

Pick the dialect your database uses: placeholders, quoting and some keywords differ (for example backticks in MySQL or square brackets in SQL Server). The formatter does not run or validate the query.

The file does not open

Check that it is one of the supported formats above and opens in another app. Damaged files and password-protected PDFs cannot be read until they are repaired or unlocked.

It is slow or stops on a very large file

Everything runs on your device, so speed depends on its memory. Close other tabs, use a computer rather than a phone, or split the file into smaller parts first.

The download did not start

Look for your browser’s download bar or icon. Some browsers ask once before a site may download files; allow it and click the button again.

Frequently asked questions

Why did formatting fail?

Usually the dialect doesn't match the query. Syntax such as backtick quoting (MySQL), [brackets] (SQL Server), $1 placeholders (PostgreSQL) or QUALIFY (Snowflake, BigQuery) only parses in the right dialect. Choose your database and try again.

Does the formatter check that my query is correct?

It checks only that the query can be parsed well enough to lay it out. It doesn't know your tables, doesn't run anything and can't tell you whether the query is fast. Use your database's EXPLAIN for performance.

Uppercase or lowercase keywords?

Either works - SQL keywords aren't case-sensitive. Uppercase makes keywords stand out from table and column names; lowercase is easier to type. Pick one for the whole project and stay consistent.

Is it safe to paste queries with real data?

Formatting happens in your browser; the query isn't sent to a server or run against any database. Values in WHERE clauses still deserve care when you share the formatted result.

Keep working with the result

After you download, choose “Save to Workstand” to keep the result in a folder on your computer, attach it to a project and create a follow-up task. It is saved by your browser, not uploaded.