TXT · Text & Data tools

SQL Formatter

Dialect
Indent
Keyword Case
Input SQL
Formatted SQL
Standard SQLdialect0statements0input lines0input bytes0output lines0output bytes

SQL formatting

Paste, drop, or import a SQL query into the input pane. The formatter rewrites spacing, indentation, line breaks, and keyword casing for the selected dialect.

The formatted output includes line numbers and SQL-specific highlighting. Keywords, data types, function calls, strings, comments, numbers, and quoted identifiers are colored separately so a long query is easier to scan before copying it into a database client.

Dialect and casing

SQL dialects differ in their functions, quoting rules, return clauses, and data types. Switch the Dialect control to match the target database before formatting. A PostgreSQL query with RETURNING, a BigQuery query with backtick identifiers, and a MySQL script with dialect-specific functions should be formatted under the matching mode.

Keyword Case controls only reserved words and SQL commands. Choose uppercase for team conventions like SELECT and WHERE, lowercase for codebases that prefer quieter SQL, or preserve when you only want spacing and indentation changed.

Indentation and statement batches

Indentation can be set to 2 spaces, 4 spaces, or tabs. Multiple statements are separated with blank lines after formatting, which is useful when cleaning up migration scripts, copied log queries, or database dump snippets.

The stats row reports the selected dialect, statement count, line counts, and byte sizes for the input and formatted output.

File export

Import accepts .sql and plain text files. After formatting, copy the highlighted result from the output pane or download a standalone formatted.sql file.

Frequently Asked Questions

It formats SQL with the selected dialect, indentation, and keyword casing. The output pane highlights SQL keywords, functions, data types, strings, numbers, comments, and quoted identifiers.

The formatter supports Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, Snowflake, BigQuery, and Redshift. Pick the dialect that matches the database syntax you are formatting.

Yes. Set Keyword Case to uppercase, lowercase, or preserve. The setting applies to SQL commands and reserved words, not table or column names.

Yes. Use Import File or drop a `.sql` or text file onto the page. The formatted result can be copied or downloaded as `formatted.sql`.

No. Everything runs in your browser; your queries never leave your device.

Explore Our Tools

Browse all tools