SQL Formatter

Beautify SQL with consistent keyword case, indentation and clause layout.

Runs entirely in your browser. Your input is never sent to a server.

About the sql formatter

Turn one-line queries into readable SQL. Keywords are cased consistently, major clauses start on their own lines, lists are broken out and nested parentheses are indented. Strings and comments are left untouched.

How to use it

  1. Paste your SQL.
  2. Choose keyword case and indent width.
  3. Copy or download the formatted query.

Frequently asked questions

Which SQL dialects work?

It targets common ANSI-style syntax shared by MySQL, PostgreSQL, Oracle and SQL Server. Dialect-specific constructs may format imperfectly but remain valid.

Does formatting change what the query does?

No. Only whitespace and keyword case change. String literals and comments are preserved.

Related tools