Zum Hauptinhalt springen
PlusDeveloper Tools

SQL Formatter

A SQL query from the log is often a text desert without line breaks, and somewhere inside hide five JOINs. The SQL Formatter shapes it up: keywords uppercased, clauses on their own lines, cleanly indented. Plus dialect selection for PostgreSQL, MySQL, SQLite and MSSQL, a query analysis and error detection - all in the browser.

A live look inside

Live preview. It becomes interactive with your account.

What SQL Formatter does

SQL is often written on one line or copied out of an ORM log - it technically runs, but it is not readable. As soon as more than one JOIN, a subquery or a nested WHERE comes in, you lose the thread. The SQL Formatter breaks your query into its parts and reassembles it cleanly: keywords uppercased, each main clause on its own line, consistent indentation for nested parts.

The formatter understands dialects. You choose between PostgreSQL, MySQL, SQLite and MSSQL, and the tokenizer recognises the keywords valid for each. That matters because the dialects differ in reserved words and subtleties - a query meant for Postgres is formatted as Postgres too, not by a generic one-size-fits-all scheme.

Conversely you can also minify a query when you want it compact in a config, a script or a single line of an application. Nicely formatted becomes compact at the press of a button and back again - whatever you need at the moment.

Beyond pure formatting, the tool analyses your query. The query analysis shows you, for example, how many JOINs are in play and how deeply your subqueries are nested - a good first hint at why a query might be complicated or slow. Error detection looks for typical pitfalls like unbalanced brackets and reports them before you send the query to the database.

So you do not start with an empty field, the formatter ships a large collection of ready example queries, grouped by theme and in the werkzeu.ge spirit with a German bureaucratic flavour. That way you immediately see what a formatted query should look like, and you have material to try out the dialects, the analysis and the error detection.

Everything runs entirely client-side. No SQL leaves your browser - no query, no schema name, no table content is sent to a server or stored. Especially with SQL that reveals internal structures or data, that is the right way. No account, no signup, no data leaving your device.

Features

Format and minify

Keywords uppercased, clauses on their own lines, cleanly indented - or compact at the press of a button.

Four dialects

PostgreSQL, MySQL, SQLite and MSSQL - the tokenizer knows each dialect's keywords.

Query analysis

JOIN count, subquery depth and structure at a glance - a first hint at complexity.

Error detection

Typical pitfalls like unbalanced brackets are reported before the query reaches the database.

Syntax highlighting

Keywords, values and identifiers clearly highlighted so the formatted query stays readable.

Ready example queries

A large, theme-grouped collection for trying out dialects, analysis and error detection.

Runs in the browser, no account

No SQL leaves your device - no query, no schema name, no table content is uploaded.

How it works

  1. 1

    Pick the dialect

    Set PostgreSQL, MySQL, SQLite or MSSQL so the keywords are recognised correctly.

  2. 2

    Paste your SQL

    Paste your query or start from one of the ready example queries.

  3. 3

    Format or minify

    Bring the query into readable shape or squash it compact - as needed.

  4. 4

    Check analysis and errors

    Look at the JOIN count and subquery depth and run error detection over the query.

Who needs this

→Developers making an unformatted query from a log readable.
→Anyone who wants to oversee a complex query with many JOINs.
→People fitting a query compactly into a config or script.
→Teams catching typical bracket and structure errors before running.
→Learners studying clean SQL layout via the example queries.

Frequently asked questions

Which SQL dialects are supported?

PostgreSQL, MySQL, SQLite and MSSQL. The tokenizer uses the matching keyword list for each dialect so your query is formatted in the right context.

Does the formatter check whether my query is correct?

There is error detection for typical pitfalls like unbalanced brackets. It does not replace a full syntax check by the database, though - whether a query really runs is ultimately decided by your database system.

What does the query analysis show me?

It breaks down structural metrics of your query, such as the number of JOINs and the nesting depth of subqueries. That is a good first indicator of why a query might be complex or potentially slow.

Can I make SQL compact again?

Yes. Alongside formatting there is minifying, which condenses the query into a compact form - handy when you want to fit it into a config, a script or a single line of code.

Is my query sent to a server?

No. The entire formatter runs in your browser. No query, no schema name and no table content is uploaded or stored. Especially for internal SQL that is the right choice.

Does the tool run my SQL query?

No. The SQL Formatter only formats, minifies and analyses the text of your query. It is executed solely by your own database.

JSON Formatter

Format, validate, and minify JSON with syntax highlighting and error detection. Free, runs in…

XML Validator

Validate and format XML documents with error detection.

Code Workshop

Multi-tab editor with syntax highlighting, live preview, console, 20+ presets and snippet man…

Code Diff

Compare two texts line by line with colored highlighting of differences.

Regex Tester

Test regular expressions with live highlighting and German pattern presets.

DATEV EÜR Export

Export your income/expense data as a DATEV-compatible posting stack in ASCII format. SKR03/SK…

Ready to use SQL Formatter?

No installation. No account needed to start. Open it right in your browser.

Open now