SQL Formatter

Free online SQL formatter and beautifier. Format, beautify, and minify SQL queries with proper indentation. Supports MySQL, PostgreSQL, SQLite, Oracle, and more database syntax.

Loading...
SQL Formatter is a free online tool designed to beautify and format your SQL queries. It transforms unreadable, minified SQL code into well-structured, easy-to-read scripts with proper indentation and casing. It supports various SQL dialects including Standard SQL, MySQL, PostgreSQL, and more.
  1. Select your SQL dialect (e.g., MySQL, PostgreSQL) from the dropdown menu.
  2. Choose your preferred indentation (2 spaces, 4 spaces, or Tab).
  3. Paste your messy SQL code into the editor.
  4. Click the 'Format SQL' button to beautify your code.
  5. Copy the formatted result using the 'Copy' button.

Which databases are supported?

We support all major SQL dialects including Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, PL/SQL, and T-SQL.

Does it validate my SQL?

This tool focuses on formatting and beautification. While it may fail on severely invalid syntax, it does not perform full semantic validation against a database schema.