SQL Formatter
Format SQL queries with uppercase keywords and line breaks.
What is SQL Formatter
SQL formatting uppercases keywords and adds line breaks and indentation per clause, making queries easier to read.
🔒 Everything runs in your browser. Nothing is uploaded.
What this tool actually does with your file
- Where it runs
- In your browser, on this page
- Upload
- None — the file never leaves your device
- Offline
- Works with the network disconnected
String literals are protected before anything moves
Every single-quoted literal is swapped for a placeholder, the text is reformatted, and the literals are restored afterwards. Without that step, a keyword inside a string — WHERE note = 'order by date' — would be treated as syntax and split across lines, changing the query's meaning.
The formatter then breaks on major clauses (SELECT, FROM, WHERE, GROUP BY, ORDER BY, JOIN) and indents their bodies. It does not parse the statement: it has no grammar, so it will happily format text that no database would execute.
Dialects it will misrepresent
Quoting differs per database: MySQL uses backticks, SQL Server brackets, PostgreSQL and the standard use double quotes for identifiers and single quotes for strings. PostgreSQL's dollar-quoted strings ($$ … $$) and MySQL's /*! */ executable comments are not recognised, so their contents may be reflowed.
That does not corrupt the query as sent to the database — the original text is unchanged apart from whitespace — but it does make the formatted version misleading to read. Verify against the original if the statement contains any of those constructs.
What formatting is for
Readability in review, and making a generated query legible. The output has no performance meaning: a database's planner ignores whitespace entirely, so a beautifully indented query and the same query on one line produce identical plans.
For correctness, formatting proves nothing. Run EXPLAIN on the real database, and use a schema-aware linter if you want to catch missing columns or type mismatches — neither is detectable from the text alone.
How to use
- 1.Paste your SQL
- 2.Click Format
- 3.Copy the result
How this compares
There are three ways to do this conversion: in the browser (this page), through a server-side converter, or with a desktop app. The useful difference is not speed — it is where your file goes and how far the free tier actually reaches.
| Aspect | This tool | Upload-based converters | Desktop software |
|---|---|---|---|
| Where the file is processed | In your browser, on this page | On the vendor's servers, after an upload | On your own machine, after installing an app |
| Account required | No | Usually — free tiers ask you to sign in before lifting a limit | No, though a licence may be needed |
| Size you can process for free | No size cap, no run limit | A few files per hour, or a ~5–10 MB cap before a paywall | Whatever your disk and RAM allow |
| Price | Free. Pro is $9/month, and only buys larger files and AI features | Usually a subscription — roughly $7–15/month as of November 2026 | A one-off licence, or a subscription |
| Works offline | Yes, once the page has loaded | No | Yes |
| Time before work starts on a 20 MB file | Immediate — there is nothing to upload | Dominated by the upload — about 16 s on a 10 Mbps uplink | Just the app launch |
| What it cannot preserve | Invalid input returns the parser error position instead of a repaired file | The same — the conversion is the same maths | The same, though some desktop apps re-render styles more faithfully |
Server-side converters are genuinely better at some things: very large files, sharing results with a team, keeping a conversion history, and automating batches from a script. For the case in front of you — one file, one format change, right now — they mostly add an upload wait and a sign-up form.
Frequently asked questions
What is SQL formatting?
It uppercases keywords and breaks clauses into lines for readability.
What about string literals?
Quoted strings are protected and kept intact.
What this kind of conversion cannot keep
Formatters parse the input into a tree and print it back with consistent indentation. If the input is invalid, you get the parser's error position instead of a silently mangled file — malformed JSON stays malformed rather than being «repaired» into something that is no longer yours.
More in Format
On this page
- What is SQL Formatter
- What it does with your file
- How it actually behaves
- How to use it
- How this compares
- FAQ
Excel formula reference
29 functions with syntax, arguments and a table you can retype.
Browse the list →