Skip to content
Popular tools

SQL Formatter

Pretty print SQL queries.

LocalYour data is processed locally in your browser and is not uploaded to Alphzen.

Paste source to format.

How to use

  1. Paste a query.
  2. Format. Major clauses start on new lines; parentheses indent.
  3. Copy or download the result. The query is never executed.

Features

  • Respects single quotes, double quotes, backticks, and comments.
  • Line-breaks SELECT / FROM / WHERE / JOIN and related clauses.
  • Does not send SQL to a database.
  • Not a dialect-perfect parser — unusual procedural SQL may need a pass by hand.
  • Local processing only.

Examples

Flattened select
select u.id,u.name from users u join orders o on o.user_id=u.id where u.active=1 order by u.name

FAQ

Will this run my query?

No. There is no database connection. Formatting is a text transform.

Which SQL dialect?

Keyword-oriented formatting aimed at common DML. Vendor-specific procedural blocks are not fully understood.

Are string literals safe?

Quoted strings and -- / /* */ comments are tokenized so whitespace inside them is not used as a clause break.

Related tools

About this tool

SQL is easier to review when clauses are visible. Alphzen pretty-prints queries locally so logs and one-line ORM output become readable.

It is a formatter, not an optimizer and not a linter. Invalid SQL may still be printed; it will not be executed.

Related: JSON Formatter for JSON inside a query string, and HTML Formatter for markup.