SQL Formatter
Paste a query that arrived from a log or an ORM as a single line, and read it as a query again — SELECT, FROM, WHERE and each JOIN on their own lines.
The code never leaves this page: formatting happens in your browser.
- Free
- Files never leave your device
- No sign-up
- No file limit
How to use
- Paste the query into the first box.
- Choose whether keywords go in capitals and whether each column gets its own line.
- Copy the result.
Good to know
Why literals are protected
A query may contain a column value like 'order by name' or a comment mentioning SELECT. A formatter that works with plain search and replace would break the line there or capitalise a word inside your data. Here, string literals and comments are set aside before formatting and put back afterwards, exactly as they were.
What the line breaks are for
Reading a query means finding three things fast: which tables it touches, how they are joined and what it filters by. Putting each clause on its own line answers all three at a glance, which is why this layout is the convention in code review — long before anyone runs the query.
Frequently asked questions
Which dialect does it support?
The clauses shared by PostgreSQL, MySQL, SQL Server and SQLite. Dialect-specific syntax is not reformatted, but it is not damaged either — unknown words pass through unchanged.
Does it check the query for errors?
No. It lays out what you give it and does not parse it. A broken query stays broken, just easier to read.
Is my query sent to a server?
No. Everything happens in your browser, which matters — queries carry table names, and often values from production.
Why are my keywords not capitalised?
Turn on «Keywords in capitals». It is a preference, not a rule: many teams write SQL entirely in lower case.
Related tools
- JSON Formatter and Validator Paste JSON and get it formatted, validated or minified. The data stays in your browser — nothin…
- CSV to JSON Paste a table, get JSON. The parser follows RFC 4180, so a cell like «Doe, John» stays one fiel…
- HTML Formatter Paste HTML and read it. Each tag goes on its own line with the indentation its nesting deserves…
- HTML Minifier Paste HTML and get it back without the whitespace nobody sees. The counter under the box shows…
- CSS Formatter Paste a stylesheet — even one that arrived as a single line — and read it again. Each declarati…
- CSS Minifier Paste a stylesheet and get it back compressed. The counter under the box shows the size before…
- XML Formatter Machine-generated XML arrives as one enormous line. Paste it here and the structure appears: on…