Skip to content

SQL Formatter

Format and beautify SQL queries with proper indentation and keyword capitalization. Minify SQL. Free online tool, 100% in your browser.

 

What is SQL formatting?

SQL formatting (also called SQL beautifying or pretty-printing) restructures raw SQL queries by adding consistent indentation, line breaks, and keyword capitalization to make them easier to read and maintain. A well-formatted query places each clause (SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY) on its own line, indents subqueries, and aligns expressions — transforming dense one-liners into clear, readable code. This is especially valuable during code reviews, debugging, and when working with auto-generated queries from ORMs.

SQL keywords and capitalization

SQL is case-insensitive for keywords, but the widely adopted convention is to write them in UPPERCASE (SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER) while keeping table names, column names, and aliases in lowercase. This visual distinction makes it immediately clear which parts of a query are language constructs and which are user-defined identifiers. This formatter automatically capitalizes SQL keywords while preserving the original casing of identifiers and string literals.

Privacy

All formatting runs 100% in your browser. No SQL queries are sent to any server.