Skip to content
Kordu Tools Kordu Tools

SQL Formatter

Runs in browser

Format, beautify, and minify SQL queries with dialect support for MySQL, PostgreSQL, SQL Server, BigQuery, and more.

Last updated 01 Apr 2026

Format messy SQL queries into clean, readable code with configurable indentation, uppercase or lowercase keyword casing, and dialect-aware syntax for MySQL, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle, BigQuery, Snowflake, Redshift, and more. Minifies SQL to a single line for embedding in code. Free, browser-based, no server.

Indent:
Keywords:
Loading rating…

How to use

  1. 1

    Paste your SQL query

    Paste your SQL query into the input panel on the left — a single statement or multiple statements separated by semicolons.

  2. 2

    Select your SQL dialect

    Choose the dialect that matches your database: MySQL, PostgreSQL, SQLite, SQL Server, Oracle, BigQuery, Snowflake, and more. Dialect selection affects keyword recognition and formatting rules.

  3. 3

    Configure formatting options

    Set indentation (2 spaces, 4 spaces, or tabs) and keyword casing (UPPERCASE, lowercase, or preserve original case) to match your team's style guide.

  4. 4

    Format or minify

    Click Format to beautify with indentation and casing, or Minify to compress the query to a single line for embedding in code or config files.

  5. 5

    Copy the result

    Click Copy to copy the formatted or minified SQL to your clipboard.

Frequently asked questions

Which SQL dialects are supported?
MySQL, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle PL/SQL, MariaDB, BigQuery, Snowflake, Redshift, Spark, Hive, Trino, PL/pgSQL, and SingleStoreDB. Select the appropriate dialect for the most accurate formatting.
Does formatting change the meaning of my SQL?
No. Formatting only changes whitespace, indentation, and optionally keyword casing. The query logic, structure, and execution plan are unchanged.
Is my SQL sent to a server?
No. All formatting runs in your browser using the sql-formatter JavaScript library. Your queries never leave your device.
Can I format multiple SQL statements at once?
Yes. Separate multiple SQL statements with semicolons and the formatter will process and indent each statement individually.
What keyword casing options are available?
UPPERCASE (SELECT, FROM, WHERE), lowercase (select, from, where), or preserve (keeps your original casing). Most SQL style guides prefer UPPERCASE for reserved words — this is the default.
Can I minify SQL for use in code?
Yes. The Minify button compresses your SQL to a single line, removing all whitespace. Useful when embedding queries in application code, environment variables, or ORM configuration.
Does it support CTEs, window functions, and JSON operators?
Yes. The formatter handles modern SQL syntax including CTEs (WITH clauses), window functions (OVER, PARTITION BY, ROW_NUMBER), JSON operators (->>, #>>, @>), and LATERAL joins. Dialect-specific syntax like PostgreSQL's $$ dollar quoting and Snowflake's QUALIFY are also handled.
Why does my formatted SQL look different from what my IDE produces?
Different SQL formatters have different opinions on line breaks, clause placement, and subquery indentation. The output here matches sql-formatter's opinionated defaults. Keyword casing and indent width are configurable to bring the output closer to your preferred style.
Can I use this to format stored procedures?
Yes. Paste a full stored procedure including BEGIN...END blocks. The formatter handles procedural SQL for Oracle PL/SQL, SQL Server T-SQL, and PostgreSQL PL/pgSQL when the corresponding dialect is selected.

SQL Formatter transforms unreadable inline queries into clean, properly indented SQL

using sql-formatter, a widely used open-source library that supports over a dozen

SQL dialects with dialect-specific keyword handling and syntax rules.

Select your database dialect — MySQL, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle

PL/SQL, BigQuery, Snowflake, Redshift, Spark, Hive, Trino, MariaDB, or SingleStoreDB

— and the formatter applies the right rules for your environment. Configure

indentation width (2 or 4 spaces, or tabs) and keyword casing (uppercase, lowercase,

or preserve) to match your team's SQL style guide.

The Minify mode strips all whitespace and compresses the query to a single line —

useful for embedding SQL in application code, configuration files, or ORMs that

build queries as strings.

Common uses: cleaning up queries exported from database admin tools, making raw ORM

output readable for debugging, standardising SQL style across a codebase, and

formatting queries before adding them to documentation. All formatting runs in your

browser with no data sent to any server.

Related tools

Learn more