Developer tools

SQL formatter

Format SQL with a chosen database dialect, indentation and keyword case.

SQL formatter
Esc to restore

Your inputs

Up to 200,000 characters. Source is processed locally and never executed.

Results update as you type. Larger files run when you press Update result.

Your result

Your result will appear here.

More actions

Your inputs stay in this browser. Nothing is uploaded or saved.

A clear answer. Here’s how.

Uses sql-formatter for the selected dialect. Formats tokens without connecting to a database, executing statements or validating a schema. A formatting error can indicate the wrong dialect. Stored procedure and dialect extensions depend on the formatter; standard SQL is not dialect auto-detection. Up to 200,000 characters.

How this is checked

2 reference checks passed These 2 cases were run when this page was built, on 3 December 2026, and all reproduce within the stated tolerance. The same cases are part of the automated tests that run on every change to Toolmoz. Engine version 1.

See the checks and where each expected answer comes from
  1. Case 1

    Inputs
    Source select 1;
    Expected, and what Toolmoz gave
    text expected SELECT 1;, Toolmoz SELECT 1;
    Where the expected answer comes from
    SELECT is a keyword, 1 is the only selected expression, and the statement terminator stays ; with a two-space indent.
    Allowed difference
    exact
  2. Case 2

    Inputs
    Source select 1;Keyword case lowerIndent 4
    Expected, and what Toolmoz gave
    text expected select 1;, Toolmoz select 1;
    Where the expected answer comes from
    The same SELECT expression with lower-case keywords and four spaces of indentation.
    Allowed difference
    exact

What this shows: the engine reproduces independently worked values for these cases. It does not prove every possible input is right. To test an answer you were given, see how to check a number; to see what is and is not checked across Toolmoz, see the accuracy ledger.

See a worked example

Worked example

A fixed demonstration, separate from the values you enter above.

Source
select id,name from users where active=1 order by name;
SQL dialect
Standard SQL
Indent
2 spaces
Keyword case
UPPER

Example result

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

Source is parsed locally and never executed. Review formatting before using the result.