Free · No sign-up · Data stays local

SQL Formatter & Minifier

Free online SQL formatter and minifier: uppercase keywords, clause breaks, nesting indentation, or collapse everything to one line — string literals are never mangled.

处理结果
输出字符数
—
输出行数
—
体积变化
—

How to Use

  1. Paste your SQL

    Drop the statement into the box, or click 'Sample' to see it in action.

  2. Pick a mode

    Choose 'Format' for readable multi-line output, or 'Minify' for a single line without comments or extra whitespace.

  3. Check the stats and copy

    Output size, line count and the size delta appear below; copy the result once you are happy with it.

FAQ

Does it change the contents of strings?

No. String literals in single or double quotes are swapped out for placeholders first and restored afterwards, so uppercasing and whitespace collapsing never touch their contents.

Can I keep my own keyword casing?

Yes. Untick 'Uppercase keywords' and the tool only reformats line breaks, indentation and minification, leaving your casing untouched.

Is minified SQL still runnable?

Yes. Minifying only collapses whitespace and removes -- and /* */ comments; the syntax is unchanged. Back up first if your statement relies on comment hints.

Is nested subquery indentation accurate?

Indentation follows bracket depth and works well for common queries. For very deep nesting, window functions or CTEs, give the result a quick manual review.

More Online Tools