Settings
SELECT u . id, u . name, COUNT(o . id) AS order_count FROM users u LEFT JOIN orders o ON o . user_id = u . id WHERE u . created_at > '2026-01-01' GROUP BY u . id, u . name ORDER BY order_count DESC LIMIT 10;
What is the SQL Formatter?
A SQL formatter takes a messy one-line query and beautifies it into readable, indented SQL -keywords uppercased, clauses on separate lines, comments preserved. This one supports five dialects (PostgreSQL, MySQL, SQL Server, Oracle, SQLite) with auto-detection from syntax cues like RETURNING, TOP n, ROWNUM, or LIMIT a, b.
Most online formatters are single-dialect and ship 10MB of JS bundled with ads. We tokenize SQL in pure JS, run the formatter in your browser, and never see your queries. Use it for code reviews, debugging ORM-generated SQL, or making auto-generated query strings readable before pasting into a ticket.
How it works
Features
Why this formatter
Most free formatters lock dialect-specific syntax behind paid tiers. We ship all 5 free.
Your SQL often contains real table names + sensitive data. We never see them. SqlFormat.org sends every query to their server.
No popups, no banner ads, no "sign up for Pro" interrupts. Just paste, format, copy.
No "pick dialect first" interrupt. Paste, get the right output, move on.
Who uses it
Real use cases
- Your ORM dumped a 400-character one-liner into the slow-query log. Paste it, format, see what columns it actually pulled. Identify the missing index in 30 seconds.
- A junior dev opened a PR with unformatted SQL. Paste their code into the formatter, copy back, review the readable version. Approve faster.
- You're documenting a complex report query for stakeholders. Format it with upper keywords + 4-space indent, paste into Notion. Readable for non-engineers.
- Migration file from another team is messy. Format every statement, commit the clean version. Future you thanks present you.
- Stack Overflow answer has unformatted SQL. Paste, format, copy -now you can actually read what the solution does.
- You wrote a query at 2am and woke up unable to follow it. Format, see the structure, debug.
Compared with other tools
| Feature | Molixa | SqlFormat.org | DBeaver Format | Prettier-sql |
|---|---|---|---|---|
| Dialects supported | 5 + auto-detect | 5 (pick first) | Many | Many |
| Auto-detect dialect | Yes | No | No | No |
| Free, no signup | Yes | Yes (ads) | Desktop install | npm install |
| Browser-only | Yes | Server-side | Local app | Build step |
| Keyword case modes | 3 | 2 | Yes | Yes |
Frequently asked questions
Is the SQL formatter free?▾
Yes. Unlimited use, no signup, no daily cap. Formatting runs entirely in your browser. SqlFormat.org is free but ad-supported and ships single-dialect output; we cover 5 dialects with auto-detection.
Which dialects are supported?▾
Five: PostgreSQL, MySQL/MariaDB, SQL Server (T-SQL), Oracle (PL/SQL), and SQLite. The auto-detect mode reads syntax cues (RETURNING, TOP n, ROWNUM, LIMIT a,b, autoincrement) and picks the right dialect for you.
Can I uppercase or lowercase keywords?▾
Yes. Three modes: upper (SELECT FROM WHERE), lower (select from where), or preserve (keep what you typed). Industry style guides usually pick upper for visibility in code reviews.
Will it format minified or one-line queries?▾
Yes. Paste a 500-character one-liner and the formatter breaks it onto multiple lines at major clauses (SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY). Indentation per your spaces setting.
Is my SQL sent anywhere?▾
No. The tokenizer and formatter run in your browser via pure JS. Your queries -including the table names, column names, and any literal data -stay on your device. No server, no log.
Does it preserve comments?▾
Yes. Single-line comments (-- like this) and block comments (/* like this */) are kept intact. Comments stay on their own line, attached to the next clause they belong to.
What about stored procedures or triggers?▾
Single SELECT/INSERT/UPDATE/DELETE statements format cleanly. Multi-statement procedural code (BEGIN ... END blocks) formats but indentation inside the block stays flat. We're a query formatter first, procedure beautifier second.
Why doesn't my JOIN format the way I expected?▾
We treat JOIN, INNER JOIN, LEFT JOIN, etc. as new-line keywords. The ON clause is also pushed to its own line. If you prefer the JOIN/ON on one line, paste before the JOIN, format, then re-combine.
Does it handle dialect-specific quoting?▾
Yes. Backticks (`col` in MySQL), square brackets ([col] in SQL Server), double quotes ("col" in PostgreSQL) all pass through unchanged. The tokenizer respects them as identifiers.
Can I get the formatted SQL back as a string?▾
Yes. The Copy button gets you the formatted SQL on the clipboard. The Download button saves it as .sql. Both work without round-tripping through any server.
Format your SQL now
5 dialects, auto-detect, browser-only. Free unlimited.
Open the SQL formatterRelated developer tools
The SQL Formatter page is built, reviewed, and maintained by the Molixa team. We use the tool we ship and update the docs when the behavior changes.
Related Developer Tools
JSON Formatter & Validator
Format, validate, tree-view, schema-gen, type-gen, diff. 100% browser-side.
Base64 Encoder/Decoder
3 variants side by side, image preview, hex dump fallback.
Regex Tester
Live regex tester with multi-flavor compare and click-to-insert cheatsheet.
CSS Gradient Generator
Create beautiful CSS gradients with a visual editor.
JWT Decoder
Decode + sign + verify HS256/384/512 in browser.
QR Code Generator
20+ QR types with styling, logo, scanner, batch CSV, and scannability score.
Popular Tools
AI Content Detector
Check if text was written by AI with a sentence-by-sentence heatmap.
YouTube Video Summarizer
Turn any YouTube video into clear notes with chapters, quotes, chat, and flashcards.
PDF Summarizer
PDF summarizer with page citations, multi-doc compare, and domain templates.
AI Text Rewriter
Paraphrase in 10 modes with diff view, freeze words, and brand voice training.
AI Math Solver
Free math solver with step-by-step solutions, photo upload, and 4 learning modes.
Watermark Remover
Brush over a watermark or object and remove it cleanly with AI. Pro/Plus.
From the blog
- How to Format SQL Query Output for ReadabilityA wall of unindented SQL hides bugs. Here is how to format a query the dialect-aware way, with a free formatter that auto-detects PostgreSQL, MySQL, T-SQL, and more.Read article
- Base64 Encode, Decode, and Inline ImagesBase64 turns binary into text so it travels safely in URLs, JSON, and CSS. Here is how to encode and decode it, the three variants that trip people up, and when to inline.Read article
- How to Decode a JWT (Decode vs Verify)Anyone can base64-decode a JWT and read it; that is not the same as verifying it. Here is the difference, the attacks that exploit the gap, and how to decode safely.Read article