SQL Formatter

Pretty-print and syntax-highlight SQL statements.

Viewer Media & Files Updated Apr 19, 2026
How to Use
  1. Paste a SQL query.
  2. Pick keyword case and indent.
  3. Copy formatted result.
Input
Formatted
Paste SQL above.

Notes

Line break
Before major clause
SELECT, FROM, WHERE…
Comma
Column lists break
Sub-queries
Indent +1
Case
UPPER keywords = convention
Semicolons
Preserved
Comments
-- and /* */ kept

Frequently Asked Questions

Dialect?

Mostly ANSI. Handles common PostgreSQL/MySQL/SQLite clauses.

Strings?

Single-quoted and $$dollar-quoted$$ strings preserved verbatim.

Common Use Cases

Log cleanup

Format a one-liner back to readable.

Code review

Consistent style.

Last updated: