SQL Formatter
Paste a query to lay it out clearly. SELECT lists, joins, WHERE conditions and subqueries are put on separate, indented lines.
Processed in your browser. Nothing you paste is sent to a server.
How to use this tool
- Paste one or more SQL statements.
- Choose keyword case and indent.
- Copy the formatted SQL.
How it works
The query is split into tokens (keywords, names, strings, numbers, comments and punctuation) without being run. Major clauses start new lines, list items after SELECT and GROUP BY get their own lines, AND/OR conditions are indented, and parentheses increase the indent. Strings, quoted names and comments are copied exactly.
Limitations
- A general formatter for common SQL; dialect-specific syntax is kept but not specially laid out.
- It does not check that the query is valid.
Privacy and data
Everything happens in your browser. What you paste or open is never sent to our server, logged or stored, and the page works offline once loaded.