DevRivet
Tools

SQL Formatter

Format and beautify SQL queries for popular SQL dialects.

Your data stays in your browser. Nothing is uploaded to a server.

Why format SQL?

Consistent indentation and keyword casing make SQL queries far easier to read, review, and debug β€” especially long queries with multiple joins, subqueries, or conditions. A formatter removes the need to manually align clauses.

How to use this tool

Paste your SQL query, choose the dialect that matches your database (Standard SQL, MySQL, PostgreSQL, SQL Server, or SQLite), and click Format. The formatted result appears below, ready to copy. Dialect-specific syntax such as PostgreSQL's ::type casts or SQL Server's TOP clause is handled correctly.

FAQ

Is my SQL sent to a server?

No. Formatting runs entirely in your browser using a local JavaScript library.

What if my query has a syntax error?

The tool shows a clear error message instead of crashing, so you can fix the query and try again.