SQL Formatter
Paste a SQL query and instantly get a clean, indented version with capitalised keywords.
Features
How to Use
1. Paste your SQL query into the input.
2. Pick a SQL dialect if needed.
3. Click Format and copy the result.
About this tool
Queries copied from logs, ORMs or monitoring tools usually arrive as one long line, which makes joins and conditions hard to follow. This formatter tokenises the SQL, puts major clauses such as SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY and LIMIT on their own lines, indents the parts beneath them, and writes keywords in uppercase so they stand apart from table and column names. Strings, quoted identifiers and comments are kept intact. It works on standard SQL syntax shared by MySQL, PostgreSQL, SQLite, SQL Server and others, and does not need a database connection. Formatting is cosmetic: it does not validate the query or change its meaning, so run it against your database to check for errors.