SQL Formatter
Paste a SQL query to reformat it with each major clause on its own line and consistent uppercase keywords.
Frequently asked questions
Does this validate that my SQL is correct?+
No, it reformats based on keyword matching, not a real SQL parser. It won't catch a syntax error or tell you a query is invalid, it just makes valid (or invalid) SQL easier to read.
Will it get confused by keywords inside a string literal?+
It can, since it doesn't fully parse string boundaries. A query with the literal text "select from where" inside a quoted string could get incorrectly reformatted. This is rare in practice but worth knowing about.
Does it work with any SQL dialect?+
It formats the common clause keywords shared across MySQL, PostgreSQL, SQL Server, and SQLite. Dialect-specific syntax (like PostgreSQL's RETURNING or MySQL's ON DUPLICATE KEY) passes through unformatted rather than being misinterpreted.