Free SQL formatter: beautify SQL queries with proper indentation for MySQL, PostgreSQL, and SQL Server
This SQL formatter tokenises your query, identifying keywords, identifiers, string literals, and comments, and reformats it with each major clause on its own line and column lists indented for readability. It handles SELECT, FROM, WHERE, JOIN, GROUP BY, HAVING, ORDER BY, LIMIT, INSERT, UPDATE, DELETE, and CREATE TABLE statements. String literals and comments are preserved exactly as written.
The keyword casing options let you match your team's SQL style guide. Uppercase keywords (SELECT, FROM, WHERE) is the traditional convention and makes keywords visually distinct from identifiers. Lowercase (select, from, where) is preferred by some modern style guides. Neither affects query execution. SQL keywords are case-insensitive in all major databases.
Minify mode collapses your formatted query to a single line. Useful for copying into application code where a multiline string would be awkward. All formatting is done client-side: your SQL queries are never sent to any server, keeping sensitive table schemas and data structures private.
SQL formatting examples: SELECT with JOINs, aggregates, and subqueries before and after formatting
Frequently asked questions about SQL formatting and query best practices
Need a disposable email address?Get a free instant throwaway email. No signup, no trace.
Get Free Temp Mail →