SQL Formatter
Paste a messy or one-line query — pretty-print or minify with the dialect and keyword style you need.
Pretty-print or minify SQL in your browser — CTEs, windows, and joins. Nothing is uploaded.
UPPER / lower rewrite keywords. Preserve keeps whatever case you typed — if the input is already lowercase, lower and Preserve look the same.
Sponsored
Ad space
How to use this tool
- Choose Format or Minify, then pick your dialect.
- Set keyword case (UPPER / lower / preserve) and indent if formatting.
- Paste SQL from a log, console, or editor. Copy the result — or Copy as string for a JS/TS literal.
Readable SQL from logs — without uploading schemas
Modern queries are full of CTEs, window functions, and nested joins. When they arrive as a single line from APM, an ORM, or BigQuery console, this tool turns them back into something you can review. Formatting stays in your tab so internal table names are not sent to a third-party server.
Need to compare two query versions as text? Try the Text Diff. Working with JSON payloads alongside SQL? Use the JSON Formatter. Loading table dumps? Try CSV ↔ JSON. Dialect-first pages: MySQL Formatter and PostgreSQL Formatter.
FAQ
Which SQL dialects are supported?
Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, BigQuery, and T-SQL (SQL Server). Pick the dialect that matches where the query will run so quoting and keywords format correctly.
Does this run or validate my query?
No. It only reformats whitespace and keyword case (or minifies). It does not connect to a database, check syntax against a live engine, or change query logic.
Is my SQL uploaded?
No. Formatting runs entirely in your browser. Table and column names never leave your device.
What is Minify for?
It collapses the query onto fewer characters for logs, string constants, or config fields — while keeping string literals intact. Use Format when you need to read the query.
Why did formatting fail?
The parser could not read the statement in the selected dialect (unusual syntax, truncated paste, or a dialect mismatch). Try another dialect, or use Minify to strip whitespace without a full parse.
Sponsored
Ad space