0 bytes

About the SQL Formatter

Raw SQL queries pasted from logs, APIs, or other tools are often a single unreadable line. This formatter breaks SQL into structured, indented blocks — each main clause on its own line with consistent keyword capitalisation and colour highlighting.

What gets formatted

All processing is client-side — your queries never leave your browser.

Common SQL formatting conventions

Well-formatted SQL is easier to debug, review, and maintain. Most style guides recommend uppercase keywords (SELECT, FROM, WHERE), one clause per line, consistent indentation for subqueries, and comma-first or comma-last alignment for long column lists. Consistent formatting also helps version control diffs stay meaningful.

Frequently Asked Questions

What SQL dialects are supported?
Standard SQL keywords used in MySQL, PostgreSQL, SQLite, and SQL Server are all handled. Dialect-specific functions are formatted as regular identifiers.
Does this validate my SQL?
No — it reformats structure only. Use your database client to validate against an actual engine.
Are my queries sent to a server?
No. All formatting runs in your browser using JavaScript. Your SQL never leaves your device.
How do I format SQL automatically in VS Code?
Install the "SQL Formatter" or "Prettier" extension (with a SQL plugin). SQL Formatter supports configuring keyword case, indentation, and operator spacing. For automated formatting in a CI pipeline, use sql-formatter npm package: npx sql-formatter --language postgresql input.sql.
What is the difference between SQL and NoSQL databases?
SQL (relational) databases store data in structured tables with predefined schemas and use SQL for queries. NoSQL databases (MongoDB, Redis, Cassandra) use flexible schemas with document, key-value, columnar, or graph models. SQL is better for complex queries and joins; NoSQL is better for high write volumes, flexible schemas, and horizontal scaling.
Related tools
Ad