Daldal Tools

SQL Formatter

Beautify SQL with consistent indentation and keyword casing, or minify it onto one line. Supports MySQL, PostgreSQL, SQLite, SQL Server, BigQuery, Snowflake and Oracle.

Runs in your browser

Input

Result

How to use

Paste a query on the left and the formatted version appears on the right. Pick the dialect that matches your database first: the parser needs it to tell a MySQL backtick identifier from a PostgreSQL cast or a T-SQL bracket, and choosing the wrong one is the usual reason a valid query is reported as a syntax error.

Keyword case can be upper, lower or left as written. Indentation is two spaces, four spaces or a tab, and the blank-line setting controls how far apart consecutive statements sit when you paste a whole script. The output is meant to be readable, not to change what the query does; comments are kept where they were.

Minify does the opposite. It removes comments and collapses every run of whitespace outside string literals and quoted identifiers into a single space, and drops spaces around parentheses and commas. Use it when a query has to fit into a log line, an environment variable or a JSON field. Because it does not parse the SQL, it also works on dialect extensions the formatter does not understand.

Queries never leave your browser, so it is fine to format SQL that contains table names, literals or customer data from a production system.

Tools people use next