SQL Formatter
Indent and align SQL for readability or collapse it to one line. Control keyword, identifier, function and data-type case, indentation (spaces or tabs), expression width, tabular layouts, leading commas and AND/OR placement. Substitute ?, $1, :name and @name placeholders with real values, split multi-statement scripts, and copy the result as a JavaScript, Python, Go, Java or C# string literal. Supports PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, Oracle, BigQuery, Snowflake, Redshift, DB2, Hive, Spark and Trino.
SELECT
u.id,
u.name,
u.email,
COUNT(o.id) AS orders,
SUM(o.total) AS revenue
FROM
users u
LEFT JOIN orders o ON o.user_id = u.id
WHERE
u.created_at >= :since
AND u.active = TRUE
AND u.plan IN ('pro', 'team')
GROUP BY
u.id,
u.name,
u.email
HAVING
COUNT(o.id) > :min_orders
ORDER BY
revenue DESC
LIMIT
50;
UPDATE users
SET
last_seen = NOW()
WHERE
id = :user_id;Related tools
JSON Formatter
Beautify, minify, sort, query and repair JSON with a tree view and copy-as code export.
HTML / CSS Prettifier
Beautify or minify HTML, CSS, SCSS, Less, JS, TS, JSON, YAML, Markdown and more — with preview and lint.
CSS Minifier
Minify CSS safely — strings, url() and calc() preserved — with gzip size and duplicate-selector merging.
How to use SQL Formatter
- 1Paste SQL, pick the dialect and choose Format or Minify.
- 2Set keyword, identifier, function and data-type case and the indent (2, 4 or tabs).
- 3Open Options for expression width, tabular layouts, leading commas, dense operators and AND/OR placement.
- 4Turn on placeholder substitution and paste a JSON array or object of values to preview the final query.
- 5Copy the SQL, a single statement from the list, or the whole thing as a JS / Python / Go / Java / C# literal.
About SQL Formatter
Indent and align SQL for readability or collapse it to one line. Control keyword, identifier, function and data-type case, indentation (spaces or tabs), expression width, tabular layouts, leading commas and AND/OR placement. Substitute ?, $1, :name and @name placeholders with real values, split multi-statement scripts, and copy the result as a JavaScript, Python, Go, Java or C# string literal. Supports PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, Oracle, BigQuery, Snowflake, Redshift, DB2, Hive, Spark and Trino.
SQL Formatter is part of FizzKit — a collection of focused developer and ad-tech tools. Because everything runs locally, it works offline once loaded and never exposes your data to a remote server.