Input SQL
Formatted Output
Formatted SQL will appear here.
SQL Pretty Printer reformats messy SQL into indented, readable form, with optional keyword uppercasing and a choice of 2 or 4 space indentation.
SQL queries arrive as a single line far more often than other code, because they are generated by ORMs, copied out of logs, or pasted from application source. A three-hundred-character line with four nested joins is effectively unreadable.
The conventional layout puts each major clause on its own line and indents the joins and conditions beneath it. Uppercasing keywords is a long-standing convention that separates the language from your table and column names at a glance, which is the fastest way to find where a clause begins.
v1.0