Format and beautify SQL — supports MySQL, PostgreSQL, BigQuery, SQLite and 17 more dialects.
- Runs locally
- Category Format Converter
- Best for Turning pasted content or local files into a handoff-friendly format.
Formatted SQL appears here.What this tool does
A fast, dialect-aware SQL formatter that runs entirely in your browser. Pick from 20+ dialects — MySQL, PostgreSQL, BigQuery, SQLite, Snowflake, Redshift, T-SQL, Oracle PL/SQL, Spark, Trino, ClickHouse and more — then choose indentation (2 spaces, 4 spaces, tab) and keyword case (UPPER, lower, preserve). Tabular-left layout aligns SELECT / FROM / WHERE columns for readable scripts. Sample queries are built in so you can try the formatter without typing anything. 100% client-side: paste a production query containing PII or schema names — nothing leaves the tab.
Tool details
- Input
- Text + Structured content
- The page exposes text boxes, numeric controls, file pickers, or structured inputs depending on the tool.
- Output
- Live result + Copy + Download
- The result area focuses on usable output, with copy, download, or preview actions when supported.
- Privacy
- Browser-side processing
- The main tool logic does not call an external API, so inputs normally stay in the current tab.
- Save / share
- No account required
- Open the page and use it; whether results survive refresh depends on the tool.
- Performance budget
- Initial JS <= 15 KB
- No WASM budget is declared, keeping the tool quick to open on mobile.
- Best fit
- Format Converter · Developer
- Category and role tags drive related tools, internal links, and quick fit checks.
How to use
-
1. Input
Paste or drop your content into the tool panel.
-
2. Process
Click the button. All processing is local in your browser.
-
3. Copy / Download
Copy the result or download to disk in one click.
How SQL Formatter fits into your work
Use it when the main problem is getting content from one practical format into another.
Conversion jobs
- Turning pasted content or local files into a handoff-friendly format.
- Previewing a conversion before you use it in a larger workflow.
- Cleaning small format mismatches without opening a full editor.
Conversion checks
- Try a small sample first when the source format is messy.
- Check character encoding, separators, and line endings after conversion.
- Keep the source until the converted output has been reviewed.
Good next steps
These links move the current task into a more complete workflow.
- 1 JSON Formatter & Validator Format, validate, and minify JSON instantly — right in your browser. Open
- 2 XML Formatter & Validator Pretty-print, minify, and validate XML in your browser — preserves CDATA, comments, and namespaces. Open
- 3 YAML ⇄ JSON Converter Convert between YAML and JSON — both directions, pretty-printed, error messages with line numbers — browser-only Open
Real-world use cases
Cleaning up a 400-line query copied out of a BI tool
Analytics dashboards export SQL as one giant single-line string with no breaks. Paste it here, pick BigQuery, hit format, and the 12 CTEs and 8 JOINs unfold into readable blocks in under a second. You can finally see which subquery joins on the wrong key before pasting it into a code review.
Standardizing keyword case across a team's migration files
One teammate writes select, another writes SELECT, a third mixes both. Before committing a 30-file migration, run each file through with keyword case set to UPPER and 2-space indent. Now every file in the PR reads the same way, and the diff stops being polluted by casing noise that hides the real schema changes.
Decoding an ORM-generated query you have to debug
Hibernate or Prisma logs a slow query as one unbroken 600-character line with cryptic alias names like t0, t1, t2. Drop it in, pick your dialect, and the WHERE clause and nested EXISTS become legible. You spot the missing index on t2.user_id in about 20 seconds instead of squinting at a wall of text.
Preparing query snippets for documentation or a blog post
You are writing a runbook and want every example query to look consistent. Format each snippet with 4-space indent and lower-case keywords for a softer reading style, then paste straight into your Markdown. Because nothing leaves the tab, internal table names in the examples never touch a third-party server.
Common pitfalls
Formatting BigQuery SQL under ANSI mode, then wondering why QUALIFY or a backtick-quoted `project.dataset.table` breaks. Always match the dialect dropdown to your actual engine first.
Leaving the indent style on "Tabular Left" for deeply nested CTEs and assuming the output is buggy. It is just an alignment choice; switch to "Standard" for normal block indentation.
Pasting a query with an unterminated string or a stray backtick and blaming the formatter. It needs parseable SQL, so fix the syntax error (often a missing closing quote) before formatting.
Privacy
Your SQL never leaves the browser tab. Formatting runs fully client-side via the sql-formatter JavaScript library, with no API calls, no logging, and no analytics on query content. Your current query and chosen options are kept in the page URL so a shared link reproduces the exact result, so avoid pasting real credentials or secret literals if you plan to share that link. Open DevTools then Network while formatting to confirm zero outbound requests.
FAQ
Tool combos
Folks in your role tend to reach for these alongside this tool.
- 555 Timer Calculator Astable f = 1.44/((R1+2R2)C) + monostable t = 1.1RC — pick R1, R2, C in Ω/kΩ and µF/nF, read frequency, duty cycle and pulse width — browser-only
- Add Line Numbers Number every line of pasted text — set start, step and separator, zero-pad to align, skip blanks, or strip numbers back off — browser-only
- AES Text Encryptor Encrypt & decrypt text with a password — AES-256-GCM + PBKDF2 via WebCrypto — 100% in your browser, nothing uploaded
- Affine Cipher Encoder & Decoder Encrypt and decrypt the ax+b affine cipher with live modular-inverse check, browser-only