UtilToolkits2025-12-23
TL;DR — Paste any SQL into the SQL Formatter to get back a clean, dialect-aware version with proper keyword casing and JOIN indentation. Supports Postgres, MySQL, SQLite, BigQuery, and Snowflake. For escaping query strings for code, use the String Escaper; for inspecting JSONB columns, the JSON Formatter.
You inherit a 500-character single-line query buried in a Python string. There’s a missing WHERE filter that causes a full-table delete. There’s a join condition swapped with a filter. There’s a LIKE '%foo%' that should have been = 'foo'. You can’t see any of it because the formatting hides the structure.
The fix is one paste. The cost of not formatting is the one query that took down prod.
// Before
SELECT u.id,u.email,COUNT(o.id) AS orders FROM users u LEFT JOIN orders o ON o.user_id=u.id WHERE u.active=true AND u.created_at >= '2026-01-01' GROUP BY u.id,u.email HAVING COUNT(o.id) > 0 ORDER BY orders DESC LIMIT 50;
// After
SELECT
u.id,
u.email,
COUNT(o.id) AS orders
FROM users u
LEFT JOIN orders o
ON o.user_id = u.id
WHERE u.active = true
AND u.created_at >= '2026-01-01'
GROUP BY
u.id,
u.email
HAVING COUNT(o.id) > 0
ORDER BY orders DESC
LIMIT 50;
You can scan the second version in 5 seconds and tell exactly what it does. The first one takes a minute and you’ll still miss something.
DELETE, UPDATE, or DROP, format the query and re-read the WHERE clause. This catches the "WHERE was actually on the wrong column" bug.SQL queries often contain real customer emails, tenant IDs, internal table names, or competitive business logic. Many "free SQL formatter" sites POST your query to their server for processing. Ours runs locally — the formatting engine ships as JavaScript and never sees the network. Verify in DevTools.
No. It only parses and re-prints — never connects to any database.
Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, BigQuery, Snowflake, Redshift, and TSQL. Dialect-specific keywords like QUALIFY (Snowflake/BigQuery) or RETURNING (Postgres) are preserved.
No — whitespace is invisible to the query planner. Formatting only changes how humans read the query.
Yes — paste the raw query (without the language quotes). After formatting, re-escape with the String Escaper if you need it back as a JavaScript/Python/Java string.