SQL Formatter
Format SQL readably with dialect, keyword-case, and indent options.
Browser onlyYour data never leaves this device.
Runs entirely in your browser. Your SQL never leaves this device, is never executed, and is never stored.
Details: Privacy policy
Input
Formats live. Never executed. Nothing is stored.
Result
Loading formatter…
The SQL formatter loads on first use.
SQL Formatter re-indents a query into something a person can read, with a dialect, a keyword case and an indent width under your control, because the same statement can look reasonable in one engine's style and wrong in another. Formatting is the whole job: nothing is executed, no connection is opened, and validity is never claimed - a statement that formats cleanly is a statement that parsed, not a statement that will run. Dialect handling is honest about its limits: syntax the chosen dialect does not cover passes through best effort, and the page says so rather than pretending the output was understood. It is the tool for the two places unreadable SQL comes from, a single line copied out of a log and a migration script written in a hurry, and for normalising keyword casing across a file so a diff shows the real changes instead of shouting about SELECT. Input is capped at five hundred thousand characters per run. Everything happens in your browser; nothing is uploaded, and no query is sent anywhere.
How to use SQL Formatter
- Paste SQL and pick a dialect, keyword case, and indent style.
- Review the formatted query live.
- Copy or download the result, or clear to start over.
What you get
- A re-indented query using the dialect, keyword case and indent width you choose.
- Formatting only: the statement is never executed and its validity is never claimed.
- Best-effort handling of syntax the chosen dialect does not cover, stated as best-effort rather than promised.
When to use SQL Formatter
- Re-indent a single-line query from logs before reading its joins.
- Normalize keyword casing across a migration script draft.
- Compare two versions of a migration script by formatting both, so keyword casing stops hiding the real change.
Frequently asked questions about SQL Formatter
Does the SQL formatter run my query?
No. It only rearranges whitespace and casing in your browser. Nothing connects to any database and validity is never claimed.
Which dialect should I pick?
The closest match to your database: standard SQL is the safe default, with PostgreSQL, MySQL, MariaDB, SQLite, Transact-SQL, BigQuery, and PL/SQL available.
Are comments and quoted identifiers preserved?
Yes. Comments stay in place and quoted identifiers keep their exact quoting and Unicode content.
What if my syntax is unsupported?
Unknown constructs pass through best-effort rather than failing. If output looks wrong, try the closest dialect or standard SQL.
Guides that compare SQL Formatter
Tools related to SQL Formatter
- JSON Formatter & Validator
Pretty-print, minify, and validate JSON with line-precise errors.
- Base64 Encoder & Decoder — encode text to Base64 and decode it back with Unicode
Encode text to Base64 and decode it back with Unicode fidelity.
- CSS Formatter & Minifier
Indent tangled stylesheets or minify them while keeping licenses intact.
- Dockerfile & Compose Generator — production-ready Dockerfile and Compose generator with
Production-ready Dockerfile and Compose generator with multi-stage builds, non-root users, and security hardening for containers locally.
- Hash Generator
Compute cryptographic hashes (MD5, SHA-1, SHA-256, SHA-384, SHA-512) in the browser.
- HTML Formatter & Minifier — indent messy HTML readably or minify it
Indent messy HTML readably or minify it, with scripts kept verbatim.
Free Software Alternative Comparisons:
⚡Embed SQL Formatter on Your Site & Get Badge↓
Embed this in-browser tool into any blog, documentation, or dashboard. Includes an optional dofollow backlink badge to credit Tools Hub.
<iframe src="https://salaq.com/embed/developers/sql-formatter" title="SQL Formatter — Tools Hub" width="100%" height="640" style="border:0;border-radius:12px;overflow:hidden;max-width:100%;" loading="lazy"></iframe>
<p style="font-size:12px;color:#6b7280;margin-top:6px;font-family:system-ui,-apple-system,sans-serif;">Powered by <a href="https://salaq.com/tools/developers/sql-formatter" target="_blank" rel="noopener" style="color:#2563eb;text-decoration:underline;">SQL Formatter on Tools Hub</a></p>Feedback
Send feedback about this tool (placeholder — feedback collection is not wired up yet).