navaja.dev / sql

SQL formatter

Paste a query to format it with clean indentation and consistent keyword case, or minify it to one line. Pick your database so its own syntax is understood.

Keywords
Indent

How to format SQL

Minify SQL safely

Minify puts a query on one line for logs, config files or code strings. It removes comments and extra spaces but never touches text inside quotes, quoted names, [brackets] or $$ bodies, and it keeps MySQL /*! ... */ and Oracle /*+ ... */ hints. Backslash escapes inside strings follow the chosen dialect.

Private by design

Queries often contain table names, customer data or credentials. This formatter runs entirely in your browser, so nothing you paste is sent to a server or stored.

Questions

Which SQL dialects are supported?

Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift, Spark, Hive, Trino/Presto, DuckDB, ClickHouse, Db2, SingleStore, TiDB and Couchbase N1QL.

Why do I get a parse error?

The query is probably missing a bracket or quote, or uses syntax from another database. Check the line and column in the message, or pick your database's dialect.

Does formatting change what my query does?

No. Only whitespace and, if you choose, the case of keywords change. Strings, names and values stay as they are. For ClickHouse, where names are case-sensitive, case is always kept.

Can I keep my keywords lowercase?

Yes. Choose lower, or Keep to leave each keyword exactly as you typed it.

Is my SQL uploaded anywhere?

No. Formatting and minifying happen in your browser, so you can paste queries with real data safely.

Does it format stored procedures?

Yes, for dialects with procedural syntax such as PL/SQL, T-SQL and PostgreSQL functions. Very unusual vendor syntax may need the closest dialect.