SQL Formatter
Turn a tangled one-line query into readable, indented SQL. Choose your dialect, keyword case and indent. Your queries, and the table names in them, stay in your browser.
- No registration
- No server involved
- 16 SQL dialects
- Keyword case control
- Runs on your device. Files are never uploaded.
- Free and unlimited. No sign-up, no watermark.
SQL formatter in three steps
No account, no email, no waiting for an upload.
- STEP 01
Paste or open your SQL
One query or a whole script. Open a .sql or .txt file if you prefer.
- STEP 02
Pick dialect and style
Choose the SQL flavor, uppercase, lowercase or as-written keywords, the indent, and blank lines between statements.
- STEP 03
Copy or download
The formatted SQL is ready to paste into your editor or review.
What SQL formatter does, and what it doesn't
We'd rather tell you up front than surprise you after the download.
What you get
- Sixteen dialectsStandard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift, Spark, Trino/Presto, DuckDB, ClickHouse, IBM Db2 and Hive.
- Keyword caseUPPERCASE, lowercase, or keep as written.
- Indent options2 spaces, 4 spaces or tabs.
- Multi-statement scriptsChoose 0 to 5 blank lines between statements.
- Comments keptComments stay in the output, so your notes are not lost.
Good to know
- Formatting, not validatingIt rearranges whitespace and keyword case. It does not run the query or check that tables and columns exist.
- Dialect must fitSyntax from another database may fail to parse. If you see an error, try a different dialect.
- Stylistic choicesThe layout is one consistent style, not configurable line by line.
Your data never leave your device
The tool runs inside your browser instead of on our servers, so there is nothing to upload, store or delete afterwards.
Typical online tool upload
Your file travels over the internet, sits on someone else's computer for a while, and you wait for the upload and the download.
Mediaextractr no upload
The tool loads into your browser once, then works on your file locally. Nothing is sent, so nothing can leak.
When people use SQL formatter
Review a pasted query
Make a query from a log or ORM readable.
Standardize team SQL
Keep scripts consistent in a repo.
Understand a long query
Break it into clauses and joins.
Share clean SQL
Post readable code in a ticket or chat.
Mediaextractr vs typical upload tools
| MediaextractrPrivate | Typical upload tools | |
|---|---|---|
| Your file is uploaded | Never | Yes |
| Sign-up needed | No | Often, after a few files |
| Daily file limit | None | Often 1–2 free files |
| Watermark | Never | Sometimes |
| Wait for upload & download | No | Yes |
| Speed on very large files | Depends on your device | Depends on their servers |
What the formatter changes
Each major clause (SELECT, FROM, WHERE, GROUP BY and so on) starts on its own line. Selected columns, joins and conditions are indented. Parentheses and subqueries get their own indented blocks.
Only layout and keyword case change. Your identifiers, values, strings and comments stay as you wrote them.
Picking a dialect
Dialects differ in quoting, functions and operators. A few examples: PostgreSQL uses double quotes for identifiers and :: for casts, MySQL uses backticks, SQL Server uses square brackets and TOP, and BigQuery has its own struct and array syntax. Choosing the right one avoids parse errors.
- Not sure? Start with Standard SQL, then try your database.
- Make a one-liner again with the SQL minifier.
- Generate statements with CSV to SQL INSERT or JSON to SQL INSERT.
Formatting for review
Format a query before reading or reviewing it, and again before pasting it into documentation. Keywords in uppercase help the eye find clauses; lowercase suits teams that prefer it. Pick whichever your team uses and stay consistent, since the formatter applies the same style to every statement in a script.
Questions, answered
How do I format SQL online?
Paste the query, choose your dialect and copy the formatted result.
Is my SQL sent anywhere when formatted?
No. The formatter library runs in your browser tab, so schema names and business logic in a query stay private.
Why do I get an error?
The text may not be valid for the selected dialect. Try another dialect or check for a typo.
Does it change my query's meaning?
No. It changes whitespace and keyword case only.
Can it format multiple statements?
Yes. Separate them with semicolons and choose the number of blank lines between them.
Does the formatter work on a phone?
Yes. Recent mobile browsers run it. Long queries scroll sideways in the result.