How to lay out or compress a SQL statement

Paste a statement into the editor and pick one of two buttons: Format SQL breaks each clause onto its own line and indents the body, Minify SQL collapses runs of whitespace into single spaces. Both transforms run inside this tab; the statement is never sent to VoriTools.

The output pane is read-only, so the result is copied or downloaded rather than edited in place. Load example fills the editor with a query that joins orders to users if you want to see the behaviour before pasting real SQL.

  1. Paste the SQL into SQL input, or press Load example to load a sample query.
  2. Press Format SQL to place one clause per line, or Minify SQL to return the statement to a single line.
  3. Read the counters above the output: Statements counts statements and ignores comment-only text, while Lines and Bytes describe the result.
  4. Press Copy to take the result, or Download to save it as kivtools-formatted.sql. Clear empties both panes.

What the transform does to your SQL

Comments and quoted text are left alone

-- and # line comments, /* block comments */ and every quoted literal survive the transform. In minified output a line comment is rewritten as a block comment, so the statement that followed it is not swallowed once its line break is gone.

Quoted text is returned unchanged: SELECT 'a b' keeps both spaces, and a semicolon or a double hyphen inside a string never splits the statement.

It reformats text, it does not parse SQL

The layout is driven by keywords, parentheses and quoting rules rather than by a parser for a particular engine, so a statement with a syntax error is still laid out and returned without a warning. The counters report size, not correctness.

Neither button contacts a database: nothing is connected to, executed or validated.

Dialect syntax passes through unchanged

MySQL backtick identifiers, SQL Server [bracketed] names and TOP, PostgreSQL ::casts with the ->> and #> operators, and Oracle functions such as NVL are left alone, because the transform changes spacing and line breaks rather than tokens. Stored-procedure bodies are laid out by keyword instead of being parsed as a block.

Size and where the work happens

Processing runs in the browser tab, so the practical ceiling is your device's memory instead of an upload limit; a 15 KB statement returns immediately.

Recent tools: