SQL Formatter: beautify any SQL query
Paste a messy query and get clean, readable SQL in one click. Uppercase keywords, break long column lists, indent WHERE conditions and joins. Everything runs in your browser, and your SQL never leaves your device. No upload, no sign-up, no tracking.
- Five dialects
- Keyword case control
- Keeps comments and strings
- Works offline
Output updates live as you type. Nothing is sent to a server.
- Runs in your browser
- No upload
- No sign-up
- No tracking
- 5 dialects
- Works offline
Other developer tools
Free developer tools that run in your browser. Nothing uploaded, ever.
SQL Formatter
You are hereFormat and beautify SQL queries in your browser
JSON Formatter
Format, validate and minify JSON
JWT Decoder
Decode and inspect JWT tokens
Base64 Encoder
Encode and decode Base64 text
Hash Generator
SHA and MD5 hashes in your browser
Diff Checker
Compare two texts and see the differences
Cron Expression Builder
Build and read cron schedules visually
Meta Tag Generator
Generate SEO and Open Graph meta tags
Schema Markup Generator
Build JSON-LD schema for SEO
PGP Key Generator
Generate PGP keys locally in your browser
HTML to PDF
Convert a web page or HTML into a PDF
Favicon Generator
Generate favicon files from an image
How this compares to other SQL formatters
Most online SQL formatters send your query to a server. This one formats locally in your browser. Same output, no upload.
| Feature | TToolDeck | Desktop formatters | Typical online tools |
|---|---|---|---|
| Runs entirely in your browser | Yes | Partial | No |
| No SQL sent to a server | Yes | Partial | No |
| No sign-up or account | Yes | No | No |
| Five SQL dialects | Yes | Yes | Yes |
| Upper, lower or preserve keywords | Yes | Yes | Partial |
| Adjustable indent size | Yes | Yes | Partial |
| Keeps comments intact | Yes | Yes | Partial |
| Free without paywalls | Yes | Partial | No |
| Works offline after page loads | Yes | Yes | No |
Comparison reflects publicly available information at the time of writing. Features may change.
How it works
- 1
Paste your SQL
Drop any SQL into the input box. SELECT, INSERT, UPDATE, DELETE, CREATE and CTEs all work. Comments and strings are preserved.
- 2
Pick your options
Choose a dialect, keyword case and indent size. The output updates instantly on the right side.
- 3
Copy or download
Click Copy to send the formatted SQL to your clipboard, or Download to save it as a .sql file. Nothing is sent to a server.
Everything you get for free
Five SQL dialects
Standard SQL, MySQL, PostgreSQL, SQLite and Microsoft SQL Server. Each dialect handles its own quoting rules, comments and keyword set.
Keyword case control
Uppercase every keyword (classic), lowercase them (Postgres style), or leave your casing alone and only fix whitespace and indentation.
Adjustable indent size
Two spaces, four spaces, or tabs. Match your team style guide exactly.
Breaks long SELECT lists
Comma separated column lists in SELECT, GROUP BY and ORDER BY get one column per line. Long queries become readable at a glance.
Where clauses get real indents
AND and OR conditions in WHERE and JOIN ON clauses each go on their own line so you can see the boolean structure of the query.
Comments kept in place
Line comments (-- like this) and block comments (/* like this */) survive the round trip. The formatter never drops them.
String and identifier aware
Single quotes, double quotes and backticks are tokenised properly. Keywords inside strings are never touched.
Nothing leaves your device
There is no backend. The formatter runs entirely in JavaScript on your device. Your SQL, table names and column names stay local.
What people use it for
Clean up messy queries
Paste a query you copied out of a log or a legacy codebase and get a readable version you can actually reason about.
Code review preparation
Format SQL before a pull request so reviewers can see the structure of the change, not whitespace noise.
Teaching and learning
See how a complex query is structured once keywords, indents and lists are on their own lines.
Documentation and runbooks
Add clean formatted SQL to internal docs, wikis and runbooks so on-call engineers can read it fast.
Stack Overflow answers
Format SQL before pasting an answer or question so it renders well and other developers can actually read it.
Migrating between databases
Switch the dialect to see how the same query looks with a different quoting and keyword convention.
Questions people ask
Is my SQL sent to a server?
No. The formatter runs entirely in JavaScript in your browser. Your query, table names and column names never leave your device. You can turn off your wifi after the page loads and it still works.
Which SQL dialects are supported?
Standard SQL, MySQL, PostgreSQL, SQLite and Microsoft SQL Server. The dialect affects keyword casing, quoting rules and how comments are handled.
Does it validate SQL?
No. The formatter is a pretty printer, not a validator. It will not tell you if a query is syntactically wrong, only rearrange whitespace and casing. Use your database client or a linter to check syntax.
Will it reformat stored procedures and functions?
Basic formatting works, but complex procedural bodies (BEGIN ... END blocks with cursors, handlers and dynamic SQL) are not fully supported. Simple stored procedures format fine.
Are comments preserved?
Yes. Both line comments (-- comment) and block comments (/* comment */) survive the round trip. The formatter never drops them and keeps them near the code they document.
What about strings with quotes inside?
Strings are tokenised as single units. Keywords, commas and parentheses inside string literals are not touched. Escaped quotes (either \" or "" doubling) are handled.
Can it uppercase function names?
Function names are left as you typed them by default. Use the Uppercase functions option if you want COUNT, SUM, AVG and similar functions forced to uppercase.
Does it work with CTEs (WITH clauses)?
Yes. WITH and its comma separated CTE list get a newline and indent, and each CTE body formats independently. Recursive CTEs work the same.
Can I format multiple statements at once?
Yes. Paste as many statements as you want separated by semicolons. Each statement gets formatted and separated by a blank line.
Does it handle window functions?
OVER, PARTITION BY and ORDER BY inside window functions are tokenised and formatted on one line to stay readable. Complex partitions with multiple columns wrap if needed.
Does it support PL/SQL or T-SQL blocks?
Simple T-SQL and PL/SQL statements format correctly. Long procedural blocks (BEGIN/END with exception handlers, IF/THEN/ELSE with large bodies) are only partially formatted.
Is there a size limit?
No hard limit. Queries up to a few hundred KB format instantly. Very large dumps or migration scripts may take a second or two on a slow device.
Can I paste SQL from MySQL Workbench or pgAdmin?
Yes. Copy your query, paste it here and it will format. Then copy the result back into your client. Whitespace and casing are safe to round trip.
Does it remove extra blank lines?
Yes. Runs of blank lines collapse to one. Multiple spaces collapse to one space outside of strings and comments.
Will it break my SQL if I paste it back?
No. The formatter only changes whitespace and keyword casing. It never changes string contents, numbers, identifiers or the order of tokens. The formatted query returns exactly the same result set as the original.
Is there an API or CLI?
No. This is a browser tool only. If you need automated formatting in a pipeline, use a dedicated formatter like sqlfmt, pgFormatter or Prettier SQL plugin.
Your SQL never leaves your device
There is no upload step and no server-side handling. The formatter is a pure JavaScript function that runs in your browser. Your query, table names, column names and any embedded connection strings stay on your computer. Open the browser network tab while using the tool and confirm there are no outbound requests carrying your SQL. Read how we keep it private.