A sleeping cat.

SQL Formatter

Format and beautify SQL queries online with support for MySQL, PostgreSQL, SQL Server, SQLite, and other SQL dialects.

SQL Formatter

Format and organize SQL queries directly in your browser.

262 characters

Formatted SQL

Output
You can also drag and drop a .sql file into the editor.

Formatting Summary

Details about the current SQL input and formatted result.

InputChange
262
Source characters
OutputChange
0
Formatted characters
StatusChange
Ready
Enter SQL and select Format SQL
♥

ToolTunnel is free and ad-free

Your support helps us build more tools and improve the ones you already use.

♥Support

Related Tools

More tools you may find useful.

About this tool

Format SQL queries online with ToolTunnel's free SQL Formatter. Improve readability with consistent indentation, keyword casing, and support for popular SQL dialects. Format queries directly in your browser without uploading them to a server.

Format SQL Queries Online

Unformatted SQL can be difficult to read, debug, and maintain. A SQL formatter organizes queries into a consistent structure, making joins, conditions, subqueries, and aggregate functions easier to understand.

Paste a query into the editor, choose your preferred formatting options, and format it instantly. Copy the result or download it as a SQL file.

Supported SQL Dialects

SQL syntax varies between database engines. Choose the dialect that best matches your database so the formatter can apply the appropriate formatting rules.

  • Standard SQL
  • MySQL and MariaDB
  • PostgreSQL
  • Microsoft SQL Server (T-SQL)
  • SQLite and Oracle PL/SQL
  • Google BigQuery and Snowflake
  • Amazon Redshift, Spark SQL, and Trino

SQL Formatting Options

Customize keyword casing and indentation to match your team's coding conventions. Use uppercase keywords for visibility, lowercase keywords for a compact style, or preserve their original casing.

Formatting improves readability but does not execute queries, change database records, or guarantee that a query is valid for your database.

Frequently Asked Questions

▶What does a SQL formatter do?

A SQL formatter organizes SQL statements with consistent indentation, line breaks, and keyword casing to make queries easier to read and maintain.

▶Which SQL dialects are supported?

The formatter supports Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server T-SQL, Oracle PL/SQL, BigQuery, Snowflake, Redshift, Spark SQL, Trino, Db2, N1QL, and SingleStore.

▶Does formatting change what a SQL query does?

Formatting is intended to improve presentation rather than query logic. Always review the formatted query before using it in production, especially when working with database-specific syntax.

▶Are my SQL queries uploaded to a server?

Formatting is performed in your browser. The SQL Formatter component does not send your query to a formatting API.

▶Can I format SQL from a file?

Yes. Drag and drop a supported .sql or .txt file into the editor, then format the loaded query.