Microdeck.tools 100% In-Browser

SQL Formatter & Query Beautifier

New

Clean up unreadable minified SQL logs or ORMs queries locally. Powered by `sql-formatter`, switch seamlessly between PostgreSQL, MySQL, SQLite, T-SQL, BigQuery, and ANSI SQL, enforce UPPERCASE or lowercase keywords, toggle 2- or 4-space indentation, or compress queries into single-line strings.

100% In-Browser No Server Storage Instant Results
Output (1 stmt, 20 lines, 319 chars)

Did this tool save you time? Help keep Microdeck free and maintained. Completely optional · From $3.

How It Works Under the Hood

Uses dialect-aware lexical tokenization from `sql-formatter` to re-indent joins, subqueries, CTEs, and `WHERE` predicates safely while string/identifier-aware minification collapses redundant whitespace and `--` / `/* */` comments without corrupting quoted literals.

Step-by-Step Instructions

1

Paste a raw SQL query, ORM trace, or migration script into Raw SQL Input.

2

Select your database dialect (PostgreSQL, MySQL, SQLite, T-SQL, BigQuery, or Standard SQL).

3

Pick keyword casing (`UPPERCASE`, `lowercase`, or `Preserve`) and 2- vs 4-space indentation.

4

Toggle Beautify vs Minify and click Copy SQL to paste cleanly into your editor or migration.

Key Features & Performance

  • Dialect-accurate formatting for PostgreSQL (`$1`, JSONB ops), MySQL, SQLite, T-SQL, and BigQuery
  • Literal-safe SQL minifier strips comments and whitespace while preserving quoted string content
  • Configurable keyword casing (`UPPERCASE` / `lowercase` / `Preserve`) and tab indentation
  • Live query diagnostics showing statement count and formatted line count
  • 100% browser-side: safe for internal schema names and sensitive production log queries

Methodology, Formulas & Technical Standards

Tokenization preserves quoted identifiers and string constants intact while normalizing clause indentation hierarchy and operator spacing per SQL dialect grammar.

Common Real-World Use Cases

  • Expanding cramped single-line Prisma, TypeORM, or Drizzle SQL query logs for debugging
  • Standardizing team SQL PR diffs with consistent keyword capitalization before code review
  • Compressing multi-line analytics queries into clean single-line strings for JSON config files
  • Inspecting BigQuery or PostgreSQL CTE pipelines offline

Worked Examples & Edge Cases

PostgreSQL Query Expansion

Input
select id,email from users where active=true order by id desc limit 10;
Output
SELECT
  id,
  email
FROM
  users
WHERE
  active = true
ORDER BY
  id DESC
LIMIT
  10;

Aligns SELECT columns, predicates, and sorting clauses automatically.

Comment-Safe Minification

Input
-- prod check
SELECT count(*) FROM orders;
Output
SELECT count(*)FROM orders;

Drops line comments while keeping quoted string tokens intact.

Limitations, Scope & Accuracy Notes

  • • Procedural dialect extensions (`PL/pgSQL` `$$` blocks or custom vendor triggers) may occasionally fall back to standard indentation rules.
  • • This tool formats syntax offline and does not validate table/column existence against a live database.

Local Browser Processing & Privacy

Traditional web converters upload your documents, snippets, or media files to remote servers. SQL Formatter & Query Beautifier runs inside your browser tab:

Processed in This Tab

Your input text and files are processed locally without uploading payloads to a processing server.

No Tool Payload Logging

Microdeck does not log or store the files or inputs you paste into tool workspaces (normal static hosting/CDN requests still load page assets).

Tab Memory Lifecycle

Working outputs stay in your browser tab and are released when you reset the tool or close the tab.

Frequently Asked Questions

Which SQL dialects are supported?

PostgreSQL, MySQL, SQLite, Microsoft SQL Server (T-SQL), Google BigQuery, and ANSI Standard SQL.

Will minifying break apostrophes or spaces inside SQL string literals?

No. The minifier walks quoted string and identifier boundaries character by character before collapsing outside whitespace.

Does formatting send my schema or queries over the network?

No. All lexing and reformatting run strictly in client JavaScript.

Can I format multiple semicolon-separated statements at once?

Yes. Statements are formatted cleanly with blank-line separation and counted in the output header.

Explore Related Micro-Tools

Support Microdeck

Completely optional · From $3 · No account required

Choose an amount (USD):Selected:$5

Minimum support amount is $3 USD.

Completely optional · From $3 · Checkout opens on Gumroad.