Skip to content
Mediawand

SQL Formatter

Make long, single-line SQL readable. Each clause starts on its own line, columns and conditions are indented, and keywords get a consistent case, in the dialect your database speaks.

How to format SQL

  1. 1Paste your SQL or open a .sql file.
  2. 2Pick your database's dialect and the keyword case.
  3. 3Copy the formatted SQL or download it.

Dialects

Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle (PL/SQL), BigQuery, Snowflake, Amazon Redshift and Spark SQL each have their own keywords and syntax; picking yours avoids misreads.

Several statements

Scripts with many statements are formatted one after another, with a blank line between them.

Errors

If the formatter can't read the SQL, you see where it got stuck, which often reveals a typo or the wrong dialect.

Frequently asked questions

Is my code uploaded?
No. Everything runs in your browser, so your code never leaves your device.
Does it run my query?
No. It only rearranges the text; nothing connects to a database.
Does it change string values?
No. Text in quotes and identifiers are kept exactly as written; only keyword case and spacing change.

Related tools

Loading tools…