SQL Formatter

Format SQL locally for PostgreSQL, MySQL, SQL Server or SQLite. Choose capitalization and indentation, remove blank lines/indentation in compact mode and compare the original and formatted lines.

File contents stay in this browser. UTM imports one URL per line.

How the calculation works

A dialect-aware tokenizer and formatter organizes SQL clauses and expressions. It changes layout and selected keyword case without executing statements or contacting a database.

Worked example

select id, name from customers where active = 1 order by name; is laid out into SELECT, FROM, WHERE and ORDER BY clauses in upper-keyword mode. Strings and comments retain their content.

Assumptions and limitations

Formatting does not prove syntax or query correctness. The library does not fully support stored procedures or custom DELIMITER directives. Compact output keeps line breaks to preserve line-comment meaning. Pasted input is limited to 262,144 characters; comparison shows at most 200 original lines.

Choose the actual database dialect before formatting. Compare outputs before using them in migration or production SQL. Never treat formatted DELETE or UPDATE statements as safer to execute.

Sources and editorial responsibility

Maintained by Renvoro Pty Ltd. Sources inform the methods and assumptions shown here; outputs have the limitations described on this page.

Method reviewed 2026-10-08. Calculation standards ยท Report an issue