SQL Formatter
Developer
Paste any SQL — a one-liner from a log, a hand-written query, or a stack-traced procedure — and see it pretty-printed with consistent indentation, keyword casing, and lines between statements. Pick the SQL dialect for accurate handling of dialect-specific syntax (window functions, returning clauses, dialect keywords). The formatter runs entirely in your browser; no SQL leaves the page.
SELECT u.id, u.name, count(o.id) AS order_count FROM users u LEFT JOIN orders o ON o.user_id = u.id WHERE u.created_at > '2026-01-01' GROUP BY u.id, u.name HAVING count(o.id) > 5 ORDER BY order_count DESC LIMIT 10;
How to use
- Paste the SQL into the input.
- Pick the dialect (default Standard SQL works for most queries).
- Choose keyword case and indent width.
- Copy the formatted output.
Frequently asked questions
- Which dialects are supported?
- Standard SQL, PostgreSQL, MySQL, SQLite, MariaDB, T-SQL (SQL Server), BigQuery, Snowflake, Redshift, and Spark SQL — provided by the sql-formatter library.
- Does it execute the query?
- No — it only reformats text. The query is never run, parsed against a real database, or sent anywhere.
- Will it break on syntax errors?
- It's resilient — the formatter does its best on partially valid SQL and shows an error message only when the input can't be tokenized at all.
- Why are comments preserved oddly?
- SQL comments don't have a strict canonical position. The formatter keeps them attached to the nearest token, which sometimes shifts indentation a little.
Related tools
JWT Decoder
Decode a JSON Web Token to inspect its header, claims, and expiration.
UUID Generator
Generate random version-4 UUIDs in bulk, with copy.
Hash Generator (SHA)
Generate SHA-1, SHA-256, SHA-384, and SHA-512 hashes from text.
URL Encoder / Decoder
Percent-encode text for URLs, or decode encoded URLs back to text.
Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to text, instantly.
JSON Formatter & Validator
Format, beautify, minify, and validate JSON right in your browser.