SQL
Runs in your browserNothing is uploadedDeveloper

SQL Formatter

Format a SQL query with uppercase keywords, a new line for each clause and consistent indents, so long queries are easy to read.

Loading tool…
Short answer

SQL Formatter lays out a SQL query with uppercase keywords, each major clause on its own line, one column per line and indented subqueries. It formats only: it does not check that the query is valid or will run.

What does a SQL formatter change?

Formatting, not validation

The formatter splits the query into words, strings, numbers and symbols and rebuilds the whitespace around them. Strings, quoted names and comments are kept exactly. It does not know your tables or your database dialect, so a typo is formatted, not flagged.

Why use SQL Formatter?

  • Read long queries. SELECT, FROM, JOIN, WHERE, GROUP BY and ORDER BY each start a line, and AND and OR conditions line up beneath.
  • Cleaner code reviews. Consistent formatting means diffs show real changes, not reshuffled spacing.
  • Nothing leaves the page. Queries often reveal table names and data. Formatting happens in your browser.

How to use SQL Formatter, step by step

SQL Formatter in PrintxPDF with a file loaded, options on the right and the run button below
SQL Formatter with a file loaded: the steps below follow this screen.
  1. Paste your query into SQL Formatter. One statement or several separated by semicolons.
  2. Choose indent and keyword case. Two spaces, four spaces or tabs, and whether keywords are uppercased.
  3. Copy the formatted SQL. Or download it as a .sql file.

Frequently asked questions

Which SQL dialects does it support?

It works on the common syntax shared by PostgreSQL, MySQL, SQLite and SQL Server. Unusual dialect features are left as written rather than reformatted.

Will it change my string values?

No. Anything in quotes, and comments, is copied exactly as it was.

Can it tell me why a query fails?

No. It is a formatter, not a validator. Run the query against your database to see real errors.

Looking for the long version? The guides cover each of these jobs in depth.