Home Text tools SQL Formatter

SQL Formatter

Struggling to read a one-line query from your logs or AI assistant? This free SQL formatter pretty-prints your SQL with consistent indentation and optional keyword uppercasing, then copies or downloads a .sql file — privately, in your browser.

Paste SQL to format.

Who is this SQL formatter for?

SQL runs from a tiny script to a huge data warehouse, so the people who reach for a formatter come from every side of a query.

What is a SQL formatter?

A SQL formatter (also called a SQL beautifier or pretty printer) takes a string of Structured Query Language and reformats it so it is easy to read and maintain — adding consistent indentation, breaking one long query into multiple lines, aligning the major clauses and optionally capitalising keywords. It never changes your logic, column names or literals; it only adds whitespace so the same query is far more legible.

A single-line query such as select id,name from users where age>18 and status='active' is hard to scan. Once formatted, each clause sits on its own line, the columns stack one per row at a consistent indent, and the conditions line up, so you see exactly what the query does at a glance.

Developers, analysts, DBAs and students use it constantly — to tidy a logged query, review AI-generated SQL, prepare statements for a report, and keep documentation snippets clean. Everything runs locally, so no SQL is ever uploaded.

How to use the SQL Formatter

  1. Paste your SQL into the SQL input box.
  2. Choose a keyword case: UPPERCASE, lowercase, or keep as written.
  3. Pick an indent size: 2 spaces or 4 spaces.
  4. Click Format SQL to pretty-print the query.
  5. Read the output, then Copy it or click Download .sql to save the file.

Example

Input: select id, name from users where age > 18 and status = "active" order by id desc;

Format with UPPERCASE keywords and 2-space indentation →

SELECT
  id,
  name
FROM
  users
WHERE
  age > 18
  AND status = "active"
ORDER BY
  id DESC;

Common Use Cases

Pro Tips

FAQ

What is a SQL formatter?

A SQL formatter, also called a SQL beautifier or pretty printer, takes a SQL string and reformats it with consistent indentation and line breaks so it is easier to read, without changing the logic.

Does it upload my SQL anywhere?

No. Formatting runs entirely in your browser, so your SQL never leaves your device.

How do I download the formatted SQL?

Click the Download .sql button and the formatted query is saved as a .sql file using the same file name for every export.

What does the keyword case option do?

It sets whether SQL keywords are uppercased, lowercased or kept exactly as written. Column and table names are never changed.

Can it format INSERT, UPDATE and DELETE statements?

Yes. The formatter handles SELECT, INSERT, UPDATE and DELETE statements and places each major clause on its own line with clean indentation.

Does formatting change my query's logic?

No. Only whitespace is added; every keyword, table, column and literal is preserved exactly. The query runs exactly the same before and after.

Does it work on a single-line query?

Yes — that is the main use case. Paste a one-line query and it is split onto multiple lines with each clause aligned.

Is it free?

Yes, it is free and unlimited, with no signup required.

Does it handle complex queries?

It handles a single statement and simple nested subqueries well. For very large or multi-statement scripts, review the output.

Related tools

Related searches

sql formatter, sql beautifier, sql pretty print, format sql online, sql formatter tool, pretty print sql, sql indentation tool, uppercase sql keywords, sql query formatter