SQL Formatter & Beautifier
Paste raw or minified SQL and get clean, readable output instantly — client-side, nothing leaves your browser.
// updated April 2026// why format sql?
Raw or minified SQL is hard to read, review, and debug. Proper formatting with consistent indentation, keyword casing, and clause alignment makes queries easier to understand and maintain.
Formatted SQL also makes code reviews more effective and helps catch logic errors like missing JOIN conditions or incorrect WHERE clauses. Read our SQL formatting best practices guide and how to format SQL queries.
// sql formatting conventions
Keywords uppercase — writing SELECT, FROM, WHERE in uppercase is the most widely used convention and makes keywords instantly distinguishable from identifiers.
One clause per line — each major clause (SELECT, FROM, WHERE, JOIN) starts on a new line for readability.
Indent subqueries — subqueries and CTEs should be indented to show nesting clearly.
Shift+Alt+F (Windows) or Shift+Option+F (Mac) to format. Alternatively, paste your SQL here and copy the result back. See our guide: SQL formatting best practices.WITH clauses (CTEs), window functions with OVER (PARTITION BY ... ORDER BY ...), subqueries, and all standard DML statements. Load the "CTE" or "Window function" snippet above to see examples.TOP (SQL Server) and ROWNUM (Oracle) are recognised as keywords.