1. What does this tool do
This free online SQL formatter formats or minifies SQL in one click. Use it to format SQL, beautify SQL, or minify SQL for readability, version control, or embedding. Paste a query and choose dialect (MySQL, PostgreSQL, SQLite, etc.), indentation, and keyword case. Beautify for readable multi-line SQL; Minify for a single line. Invalid SQL shows an inline error so you can fix it. No sign-up, no upload; all processing runs in your browser so your queries stay private. Ideal for readability, version control, minification, or dialect check.
2. How to use it
Quick start: Paste your SQL, select dialect and options (indent, keyword case), click Beautify or Minify, then copy the result.
- Paste SQL — Paste your SQL into the input area.
- Choose options — Select dialect (to match your database), indent style, and keyword case.
- Beautify — Click Beautify to format with newlines and indentation.
- Minify — Click Minify to produce a single-line, space-collapsed version.
- Copy — Copy the formatted or minified output to the clipboard.
3. How it works
The tool uses the sql-formatter library to parse and reformat SQL. The chosen dialect affects how the parser interprets syntax (e.g. bracket identifiers for T-SQL). Format applies indentation and keyword casing; minify runs the same formatter then collapses runs of whitespace to a single space. If the parser cannot parse the input, an error message is shown. All processing runs client-side in your browser. No data is sent to any server.
4. Use cases & examples
- Readability — Format one-line or messy SQL for reviews and docs.
- Version control — Consistent formatting for diffs.
- Minification — Shrink SQL for logging or single-line embedding.
- Dialect check — See how the formatter interprets your query (pick the right dialect).
Example
Input: SELECT id, name FROM users WHERE active=1 ORDER BY name;
Formatted (2 spaces, upper): multi-line with indentation.
Minified: SELECT id, name FROM users WHERE active = 1 ORDER BY name;
5. Limitations & known constraints
- Dialect-specific — Pick the correct dialect; otherwise the parser may fail or misformat.
- No stored procedures — The library does not support formatting stored procedure bodies.
- Single delimiter — Only semicolon is supported as statement delimiter.
- Syntax only — Validates/formats syntax only; does not check schema or run queries.