Skip to main content

SQL Formatter

Format and beautify SQL queries with configurable indentation and keyword casing.

Formatted SQL
Formatted SQL will appear here...

How to use the SQL Formatter

  1. Paste your SQL query into the input box.
  2. Choose keyword casing (UPPERCASE or lowercase).
  3. Select indentation size.
  4. Click Format SQL to see the result.

About SQL Formatter

Long SQL statements are easier to review when clauses, joins, and nested expressions are laid out consistently. This SQL formatter uses the sql-formatter parser library to indent a query and optionally normalize keyword capitalization.

Formatting changes presentation, not query intent, and it does not execute SQL or connect to a database. Review the resulting query before using it, particularly when the input contains dialect-specific syntax or application-generated fragments.

How to use this tool

Paste a SQL statement, set keyword casing and indentation, then choose Format SQL. Review the formatted text before copying it into your editor.

Frequently asked questions

Does formatting run my SQL?

No. The tool only parses and formats query text in your browser. It never connects to or executes against a database.

Which SQL dialect should I use?

The current formatter uses its generic SQL language mode. Dialect-specific extensions may not be formatted exactly as your database expects.

Can a formatted query change its meaning?

The formatter is intended to change whitespace and keyword casing only. Still review the output and test it in a safe environment before running important queries.

Related Tools