Free AI Tools

View all 83 →

SQL Formatter

SQL copied from a log file, an ORM debug message or a colleague's chat often arrives as one enormous line: select u.id,u.name,count(o.id) from users u left join orders o on…. Before you can understand it, review it or spot the missing join condition, you need it laid out properly. This free SQL formatter beautifies queries instantly. It puts each major clause (SELECT, FROM, JOIN, WHERE, GROUP BY, ORDER BY and so on) on its own line, lists selected columns one per line, indents AND/OR conditions and subqueries in brackets, and separates multiple statements with a blank line. Choose whether keywords are UPPERCASE, lowercase or left as written, and pick 2 spaces, 4 spaces or tabs for indentation. The formatter works on tokens, not plain text, so string literals, quoted identifiers and comments are never changed. A comma inside 'Smith, John' stays exactly where it is. It handles the common syntax shared by MySQL, PostgreSQL, SQL Server, SQLite, BigQuery and Oracle, including CTEs (WITH), CASE expressions, UNION, INSERT, UPDATE and DELETE. Need the opposite? Minify collapses a query back onto one line. Your queries are never uploaded.

Format SQL

How to format SQL

  1. Paste your query.
  2. Pick the keyword case and indentation.
  3. Press Format (or Minify) and copy the result.

Readable SQL habits

  • One clause per line, columns one per line.
  • Always alias tables in joins.
  • Comment why, not what.

FAQ

Which SQL dialects are supported?

Common syntax from MySQL, PostgreSQL, SQL Server, SQLite, Oracle and BigQuery. Very dialect-specific syntax is passed through unchanged.

Will it change my strings?

No. Quoted strings, quoted identifiers and comments are kept exactly.

Does it validate my query?

No. It formats only; it doesn’t check that the SQL will run.

Is my SQL uploaded?

No. Formatting happens in your browser.

Related on Botvana

Comments

Contact Botvana

Newsletter

One short email every Friday: the AI news that matters and one tool worth trying.

Botvana
Home About Newsletter
Home Topics Search Newsletter