100% offline
Developer
Free · no signup
Updated

SQL Formatter

A SQL Formatter reformats a raw SQL query into clean, consistently indented SQL — with configurable dialect, keyword casing, and indentation — entirely in your browser, so queries never leave your machine.

SQL input
Formatted
(empty)

About SQL Formatter

Paste a cramped one-line query and get readable, indented SQL back instantly. Choose the dialect (Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server/T-SQL, or BigQuery), whether keywords are uppercased, lowercased, or preserved, and 2- or 4-space indentation. Formatting is powered by the sql-formatter library running locally — your queries, which often contain schema and data details, are never uploaded.

What SQL Formatter does

  • Formats 7 dialects (Standard, PostgreSQL, MySQL, MariaDB, SQLite, T-SQL, BigQuery)
  • Uppercase, lowercase, or preserve keyword casing
  • 2- or 4-space indentation
  • Live formatting as you type
  • Copy the formatted query with one click
  • Runs entirely in your browser — queries never uploaded

When to reach for SQL Formatter

  • Making a minified or generated query readable for review
  • Standardizing SQL style before committing to version control
  • Understanding an unfamiliar query's structure
  • Cleaning up SQL pasted from logs or an ORM

How to use SQL Formatter

  1. 01

    Paste SQL

    Paste your query into the input pane.

  2. 02

    Set options

    Choose dialect, keyword case, and indentation.

  3. 03

    Copy

    Copy the formatted SQL from the output pane.

When to use SQL Formatter vs alternatives

AlternativeUse SQL Formatter when…Use the alternative when…
Online SQL beautifiersyour query contains sensitive schema or data and you refuse to paste it into a third-party server.you need dialect-specific linting beyond formatting.
An IDE format commandyou want a quick format on any device without opening the project.you're already in the IDE and it's configured.

Frequently asked questions

Which SQL dialects are supported?
Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server (T-SQL), and BigQuery. Pick the one matching your database so dialect-specific syntax is formatted correctly.
Does formatting change what my query does?
No. Formatting only adjusts whitespace, line breaks, and keyword casing — the query's logic and identifiers are untouched.
Are my queries sent to a server?
No. Formatting runs in your browser via the sql-formatter library. Your SQL, which often reveals schema and data, never leaves your device.
Can it uppercase keywords like SELECT and FROM?
Yes. Set keyword casing to UPPERCASE (the default), lowercase, or preserve to keep whatever you typed.