sitekits.dev
press ⌘K to switch tools
FORMAT & CONVERT

SQL Formatter

Format SQL queries with selectable dialect for better readability.

local
sql-format
§01 ABOUT THIS TOOL

Overview

This tool pretty-prints SQL using the widely used sql-formatter library: keywords are uppercased, clauses (SELECT, FROM, WHERE, ORDER BY) go on their own lines, and select lists are broken up for readability. A dialect selector adjusts parsing for MySQL, MariaDB, PostgreSQL, SQLite, BigQuery, and Transact-SQL, so dialect-specific operators and quoting are handled correctly. Handy for cleaning up ORM-generated queries or one-liners copied from logs.

How to use

  1. Pick your database from the Dialect dropdown (sql, mysql, postgresql, sqlite, mariadb, bigquery, or transactsql).
  2. Paste the query into the SQL field.
  3. The result appears in Formatted instantly; a parse error for the chosen dialect is shown above the output.

Examples

  • select id,name from users where active=1 order by name

    SELECT
      id,
      name
    FROM
      users
    WHERE
      active = 1
    ORDER BY
      name
    

Notes

If a valid query errors, try another dialect — vendor-specific syntax often fails under the generic sql setting. Keyword casing is fixed to uppercase.

FAQ
Are my queries sent to a server?
No. Formatting runs entirely in your browser using the open-source sql-formatter library. Queries containing table names, schemas, or embedded values never leave your machine.
Which SQL dialects are supported?
Seven options: standard sql, mysql, mariadb, postgresql, sqlite, bigquery, and transactsql (SQL Server). Picking the right dialect matters for dialect-specific syntax like PostgreSQL casts (::), BigQuery backticks, or T-SQL bracket identifiers.
Does formatting change what the query does?
No. The formatter only rearranges whitespace, line breaks, and keyword casing (keywords are uppercased). Identifiers, literals, and query semantics are untouched.