Skip to content
Tesserae

Keyboard shortcuts

Focus search
/
This help dialog
?
Run the current tool
Ctrl/⌘ +Enter
Copy the output (when an output is focused)
Ctrl/⌘ +C

Shortcuts are ignored while you are typing in an input, a textarea or a select.

Developer Utilities

SQL Formatter (basic)

A lightweight SQL pretty-printer. It uppercases keywords, starts each major clause on its own line, indents JOIN conditions and AND/OR, and breaks a multi-column SELECT list one column per line. String literals and comments are left untouched.

On-device No network Offline-ready

🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.

Try:

Options

Your result will appear here

Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.

How it works

What the formatter rearranges

The result is one normalised statement: whitespace collapses to a single space, every major clause — SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING, LIMIT, UNION, INSERT INTO, UPDATE, SET, DELETE FROM and any JOIN — starts on a new line, and ON, AND and OR go on their own indented lines. A SELECT listing more than one column is expanded one column per line, with parentheses respected so a comma inside a function call does not split the list.

Literals and comments are untouchable

Before anything else, single-quoted strings, double-quoted identifiers, -- line comments and /* block */ comments are lifted out and replaced by sentinels. Formatting runs on what remains and the sentinels are put back, so a keyword inside a string or an odd indentation in a comment comes out exactly as typed. The stats report how many literals were preserved.

The options

Uppercase keywords rewrites any keyword from the tool’s list, including function names such as COUNT and COALESCE and words like NULL, LIKE and BETWEEN, without touching identifiers. Indent width picks two or four spaces, applying to both AND/OR condition lines and the expanded column list. Turning casing off gives structure-only formatting.

Why it is called basic

This is a rule-based prettifier, not a SQL grammar. It handles common SELECT, INSERT, UPDATE and DELETE shapes, but nested subqueries, dialect-specific constructs and CASE expressions get the same flat rules rather than structural formatting, and an unterminated quote or block comment stops the run with an error. Everything is pure string work in this tab, with nothing uploaded.

Questions

Is this a real SQL parser?

No. It is a formatter built from string rules, not a grammar. It handles common SELECT/INSERT/UPDATE/DELETE shapes but will not understand every dialect or deeply nested statement.

Will it touch my string literals or comments?

No. Single- and double-quoted text, -- line comments and /* block */ comments are masked before formatting and restored verbatim.

Why did it report an unterminated string?

The input has an opening quote or /* with no matching close, so the formatter cannot tell where the literal ends.

See category