SQL Formatter

Turn long, single-line SQL into readable queries with each clause on its own line, consistent indentation and upper- or lower-case keywords. Supports the major SQL dialects and multiple statements at once — handy for code reviews, documentation and debugging.

Keywords
Indentation

This tool runs entirely in your browser. Your files and text are processed on your own device and are never uploaded to our servers.

How to use the SQL Formatter

  1. Paste one or more SQL statements, or open a .sql or text file. Use “Example” to try it.
  2. Choose your database dialect so its specific syntax (such as backticks in MySQL or square brackets in SQL Server) is understood.
  3. Pick the keyword style — UPPER, lower or keep as written — and the indentation.
  4. Copy the formatted SQL or download it as a .sql file.

Examples

A one-line query

Input
select id, name from users where active = 1 and country = 'NO' order by name
Result
SELECT
  id,
  name
FROM
  users
WHERE
  active = 1
  AND country = 'NO'
ORDER BY
  name

Lower-case keywords

Choose “lower” if your team’s style guide prefers select … from … where; identifiers and string values are never changed.

About the formatter

Formatting is done by the open-source sql-formatter library, which understands each dialect’s syntax. It only changes whitespace and, if you choose, the case of SQL keywords — table names, column names and values in quotes are left untouched, so the formatted query behaves exactly like the original.

Frequently asked questions

Is my SQL sent to a server?

No. Your queries are formatted in your browser, so table names, data and credentials in them stay on your device.

Which dialect should I choose?

Pick the database the query runs on. Standard SQL works for most simple queries; dialect-specific features like MySQL backticks, PostgreSQL :: casts or SQL Server [brackets] need the matching dialect.

Does it check that my SQL is correct?

It reports syntax it can’t understand, but it doesn’t know your tables or columns, so a nicely formatted query can still fail when run. Use your database to validate queries.

Can I format several statements at once?

Yes. Separate statements with semicolons and each one is formatted, with a blank line between them.

Everything you need. One simple place.

Free, fast online tools for text, PDFs, images, data and everyday maths. Every tool runs entirely in your browser, so your files stay on your device.

  • Privacy-first processing
  • No sign-up required

© 2026 Toolora. All rights reserved.

Built for speed and privacy