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…
- Base64 Encode and Decode Paste text to get Base64, or paste Base64 to get the text back. Cyrillic, Chinese and emoji all…
- Word Counter Type or paste your text and the counters update instantly — words, characters, sentences, parag…
- Case Converter Paste text, pick a case, get the result. Nine ways of writing the same words: the four everyday…
- JSON Beautifier Paste a wall of minified JSON and read it like a document. Indentation appears as you type, and…
- JSON Minify Paste JSON and get it back without a single wasted byte: no indentation, no line breaks, same d…