LazyTools

🔒 Every tool runs in your browser, the files and values you enter are never uploaded to any server. How it works

🗃️ SQL Formatter

Paste messy or minified SQL and get it pretty-printed with consistent indentation, line breaks and keyword casing, for the database dialect you choose.

Beautifies (pretty-prints) SQL with consistent indentation, line breaks and keyword casing, for the dialect you choose. Great for cleaning up generated or minified queries and making them readable in code review. Your SQL, which can reveal schema and data, is formatted entirely in your browser and never uploaded. 🔒

Rate this tool:
Anonymous, no account, no identifier

How the sql formatter works

The formatter parses your SQL for the chosen dialect and re-prints it with each clause on its own line, nested expressions indented, and keywords cased consistently (upper, lower or preserved). It understands dialect-specific syntax for MySQL, PostgreSQL, SQLite, SQL Server (T-SQL), BigQuery, Snowflake, Spark and standard SQL. Everything runs in your browser, so queries, which can reveal your schema and data, are never uploaded.

Formatting only changes whitespace and keyword casing; it never alters what your query does. Pick the dialect that matches your database for the most accurate results, especially with vendor-specific functions and syntax. It's ideal for tidying up ORM-generated or one-line queries before code review, or making a complex query readable while you debug it.

Frequently asked questions

How do I format SQL?

Paste your query, choose the database dialect and keyword casing, and click Format SQL. You get a clean, indented version you can copy, all done locally in your browser.

Does formatting change my query's results?

No. It only adjusts whitespace, line breaks and the letter case of keywords. The logic and results of the query are completely unchanged.

Which SQL dialects are supported?

Standard SQL plus MySQL, PostgreSQL, SQLite, MariaDB, SQL Server (T-SQL), BigQuery, Snowflake and Spark SQL. Choosing the right one handles dialect-specific syntax correctly.

Does it validate or run my SQL?

No. It is a formatter, not a linter or an engine. It re-indents and re-cases the text but does not check whether tables exist, the syntax is fully correct, or the query would run. A malformed query is reformatted as best it can, not rejected.

Can it minify SQL instead of expanding it?

This tool is built to expand and indent for readability rather than to compress. If you need a single-line query, formatting first makes it easy to review, and you can collapse whitespace afterwards, but the value of a formatter is turning a one-liner back into something a human can read.

Is my SQL sent to a server?

No, the formatting runs entirely in your browser, so your queries and the schema they reveal never leave your device. It works offline once loaded.

Related developer tools