Text and dataRuns in your browser

SQL Formatter for Readable Queries

Turn SQL into a consistent, reviewable layout while preserving quoted values and comments, with no database connection.

  • Runs locally
  • No query execution
  • Bounded tokenizer
Online tool

Try the tool

Add your data, choose the settings, and get the result.

SQL query

Formatted query

—

Standard / PostgreSQL / SQL Server mode treats backslashes in ordinary strings literally and supports nested /* ... */ comments. MySQL mode enables backslash string escapes and ends a block comment at the first */. The formatter preserves strings, comments, and quoted identifiers; it does not perform semantic validation or execute SQL.

Your data stays here

Text and selected files are processed in the current browser and are not sent to a server to produce the result.

Reviewed: 2026-07-17
01

How to use it

  1. 1

    Paste SQL and choose the keyword casing.

  2. 2

    Choose two- or four-space indentation and run the formatter.

  3. 3

    Review any dialect warnings and copy the result.

02

What the tool can do

  • Common SELECT, INSERT, UPDATE, DELETE, WITH, UNION, JOIN, ordering, and grouping clauses.
  • Strings with escaped quotes, line and block comments, and quoted identifiers.
  • Nested subqueries with bounded depth and readable indentation.
  • Uppercase, lowercase, or preserved keyword casing.
03

Common use cases

  • Preparing a query for code review.
  • Reading SQL copied from logs or migrations.
  • Normalizing an example for documentation or an issue.
04

How it works inside

Input is limited to 500,000 characters, 20,000 tokens, and depth 64.

The formatter does not connect to a database or send SQL to the WebDiag backend.

05

Questions and answers

Can it confirm that the query will run?

No. That requires the target database parser and schema, or a controlled test database. This tool only checks bounded lexical structure and delimiters.

Is the SQL uploaded?

No. Tokenization and formatting run locally in your browser.