Utilo

SQL Formatter & Dialect Converter

Beautify SQL queries and convert syntax between MySQL, PostgreSQL, SQLite and SQL Server: identifier quoting, LIMIT/TOP/OFFSET, AUTO_INCREMENT/SERIAL/IDENTITY, data types and common functions.

What this SQL formatter does

This tool does two jobs. First, it formats SQL: one clause per line, consistent indentation, upper- or lower-case keywords and readable JOIN and CASE blocks, using the battle-tested sql-formatter engine with dialect-aware parsing. Second, it performs basic dialect conversion between MySQL, PostgreSQL, SQLite and SQL Server, handling the differences that bite most often when moving a query or a schema between databases. Everything runs locally, so production queries containing real table names never leave your browser.

How to use it

  1. Paste SQL into the input.
  2. Choose the source dialect and, if you want to convert, a target dialect. Leave the target as "keep" to only format.
  3. Pick keyword case and indentation width.
  4. Review the notes panel: anything the converter could not translate safely is listed there.
  5. Copy the result.

What the converter handles

  • Identifier quoting: `name` (MySQL) ↔ "name" (PostgreSQL/SQLite) ↔ [name] (SQL Server).
  • Row limits: LIMIT n OFFSET m ↔ TOP n ↔ OFFSET m ROWS FETCH NEXT n ROWS ONLY.
  • Auto-increment: AUTO_INCREMENT ↔ SERIAL/GENERATED ... AS IDENTITY ↔ AUTOINCREMENT ↔ IDENTITY(1,1).
  • Common types: DATETIME/TIMESTAMP, TINYINT(1)/BOOLEAN/BIT, NVARCHAR, TEXT, BLOB/BYTEA/VARBINARY(MAX).
  • Functions: NOW()/GETDATE()/CURRENT_TIMESTAMP, IFNULL/ISNULL/COALESCE, RAND()/RANDOM(), CONCAT ↔ ||.
  • String literals and comments are protected, so a keyword inside 'quotes' is never rewritten.

Limitations

Dialect conversion is pattern-based, not a full compiler. Stored procedures, triggers, vendor-specific functions (window frame quirks, JSON operators, MERGE, ON DUPLICATE KEY vs ON CONFLICT) and collation details need a manual review. Treat the output as a strong first draft and test it against the target database.

Frequently asked questions

Does formatting change what my query does?

No. Formatting only changes whitespace and keyword case. Identifiers and literals are untouched.

Can I format multiple statements?

Yes. Separate them with semicolons and each statement is formatted on its own.

Why is my query not converted completely?

Some constructs have no direct equivalent. The notes panel lists what needs attention.

Is my SQL uploaded?

No. Formatting and conversion run entirely in your browser.

Yes. All processing happens directly in your browser using JavaScript, Web Workers and Web APIs. Nothing you type, paste or upload is sent to our servers.