About SQL Formatter
Long SQL queries copied from logs or ORMs are hard to read. Paste a query and get neatly indented SQL with consistent keyword casing, making it easier to review, debug and share.
How to use SQL Formatter
- Paste your SQL query into the input box.
- Choose your SQL dialect, such as MySQL or PostgreSQL.
- Choose the indentation and keyword case.
- Click "Format SQL", then copy or download the result.
Tips
- Choosing the correct dialect helps the formatter understand special syntax such as backticks or square brackets.
- Upper-case keywords make it easier to tell SQL commands apart from table and column names.
- Formatted queries are much easier to review in pull requests and to compare with the Text Diff tool.
- Format queries copied from application logs before debugging them; nested subqueries become far easier to follow.