CODDY Tool

SQL Formatter

Format SQL queries with proper indentation, across a dozen database dialects.

Turn a dense or hand-mangled SQL query into something readable, with consistent keyword casing and indentation. Supports the dialect-specific syntax of MySQL, PostgreSQL, SQL Server, Oracle, BigQuery and more, since a formatter built only for standard SQL mishandles most real queries.

Everything you enter stays in this browser tab. Nothing is sent to our servers, logged or stored.

Loading tool…

About SQL Formatter

A query built up through several edits, or copied out of a slow-query log, is usually one dense wall of text. Formatting adds the line breaks and indentation that make a join, a subquery or a CASE expression visible at a glance, which is most of what makes a long query reviewable at all.

SQL is not one language. Standard SQL covers the common core, but MySQL, PostgreSQL, SQL Server's T-SQL, Oracle's PL/SQL and the analytical dialects like BigQuery and Snowflake each add syntax the others reject — backtick-quoted identifiers, a QUALIFY clause, T-SQL's square-bracket identifiers. A formatter that only understood standard SQL would either choke on those or format them wrong, so the dialect is a real setting here, not decoration.

Keyword case is a separate, purely stylistic choice — some teams write SELECT in caps to distinguish keywords from identifiers at a glance, others prefer lowercase throughout for consistency with everything else in the codebase. Either is applied uniformly across the whole query.

How to format SQL

  1. Paste your query

    One statement, or a whole script — each is formatted separately.

  2. Choose a dialect

    Match the database the query actually runs against.

  3. Set keyword case and indent

    Uppercase, lowercase or as typed; two spaces, four spaces or a tab.

  4. Copy or download

    Take the result to your clipboard or save it as a .sql file.

Frequently asked questions

Does the dialect actually matter?

Yes, for anything beyond a simple SELECT. Backtick-quoted identifiers are MySQL-specific, square brackets are T-SQL, QUALIFY is BigQuery and Snowflake, and PL/SQL's block syntax has no standard-SQL equivalent at all. Choosing the wrong dialect can produce a result that no longer means what the original query meant.

Why did formatting fail on my query?

Usually a syntax error in the query itself, or dialect-specific syntax parsed against the wrong dialect. Try switching dialects, and check the query runs correctly against the database it targets.

Can I format multiple statements at once?

Yes — paste a whole script and each statement is formatted individually, separated by a blank line, in its original order.

Is my query or schema sent anywhere?

No. Formatting happens entirely in your browser, which matters given how often a real query embeds table names, column names or literal values that describe your schema or your data.

All Developer Tools

SQL Formatter is free to use with no account, no watermark and no usage limits. Last updated 3 September 2026.