SQL formatter
Re-indent generated or minified SQL into something reviewable.
Input
Result
The result will appear here.Your runs
Only runs that cost points are saved.
Sign in to keep a history of your runs.
ORM-generated SQL and query-log output arrive as one long line, which is unreadable exactly when you most need to read it. This re-indents it with dialect-aware keyword handling for PostgreSQL, MySQL, SQLite and BigQuery, so joins, subqueries and CTEs line up the way a reviewer expects.
How it works
- Formatting runs in your browser on sql-formatter, the library most SQL tooling uses.
- Choosing a dialect changes which words are treated as keywords and how its quoting rules apply.
- Keyword case and indent width are yours to set; the tool does not rewrite anything else.
Where your data goes
Nowhere. This tool runs entirely in your browser: the text you paste is processed by the page and is never transmitted to a server or written to a log.
When a run costs points, a one-line summary is saved to your own history so you can find it again. The summary records the shape of the run — sizes, counts, the values you looked up — never the content you pasted.
What it costs
Free up to 50.0 KB per run without an account. Past that, a run costs 1 points and is saved to your history.
Points come from signing up, checking in daily, commenting and completing your profile.
See how points workCommon questions
- Does this change what my query does?
- No. Only whitespace and keyword casing change. Identifiers, literals and structure are left exactly as they were.
- Why does my dialect-specific syntax come out oddly?
- Pick the matching dialect. Formatted as generic SQL, constructs like PostgreSQL's :: casts or BigQuery's backtick-quoted names are not recognised as the syntax they are.
- Can it format a query with parameter placeholders?
- Yes. Placeholders in every common style — ?, $1, :name — are preserved as written.
The open-source behind it
This tool runs on sql-formatter-org/sql-formatter, released under MIT. If you need the same behaviour inside your own program, that is the library to reach for.
sql-formatter-org/sql-formatterAlso known as
- sql formatter
- format sql online
- sql beautifier
- sql pretty print
- postgresql formatter