SQL Formatter

Format SQL with one of 21 bundled dialects, keyword case and two, four or eight-space indentation.

On-device No sign-up Free to use

Format SQL controls

Showing an example. Edit to see your own.

?

Formatting changes spacing and keyword case. It does not validate or execute SQL.

?

The dialects the formatter in this page supports. 21 are offered, from Standard SQL to Snowflake and T-SQL.

?

The number of spaces one indent step uses. Two suits most reviews; four suits a house style that indents by four.

Processed in your browser. Your inputs stay on this device.

Result

Showing an example.

Lay out a SELECT query with uppercase keywords and two-space indentation.

SELECT
  name,
  email
FROM
  members
WHERE
  active = 1
ORDER BY
  name;

Loading the tool. Your result will appear here.

https://usefreetools.net/sql-formatter · 20 November 2026

Was this helpful?

How to use SQL Formatter

  1. Paste a SQL query or script into the editor.
  2. Choose its SQL dialect and keyword case.
  3. The formatted SQL updates as you change the query, dialect or keyword case. Review it before running it in your own database.

Example: SQL Formatter

Lay out a SELECT query with uppercase keywords and two-space indentation.

You add
SQL: select name, email from members where active = 1 order by name;; SQL dialect: sql; Keyword case: upper; Indent width: 2
You get
SELECT name, email FROM members WHERE active = 1 ORDER BY name;

Options

SQL
Formatting changes spacing and keyword case. It does not validate or execute SQL.
SQL dialect
The dialects the formatter in this page supports. 21 are offered, from Standard SQL to Snowflake and T-SQL.
Keyword case
Change recognized SQL keywords to uppercase or lowercase, or preserve their original case. This does not check table names or query permissions.
Indent width
The number of spaces one indent step uses. Two suits most reviews; four suits a house style that indents by four.

Supported inputs and limits

  • Formatting changes layout and, if selected, keyword case.
  • It does not parse against your database schema, check permissions or prove the query is safe.
  • Choose the closest supported dialect; vendor extensions may format imperfectly.
  • Input is capped at 200,000 characters.
  • The bundled formatter changes layout, not database behavior.
More details

SQL minification is not provided.

Where your input is processed

This tool does not upload your inputs. See the limits for anything saved on your device.

Questions about SQL Formatter

Will this page run my SQL?

No. It only rewrites text in your browser and has no database connection.

Which dialect should I choose for MariaDB?

Choose MariaDB; its keywords and syntax can differ from other SQL engines.

Does a formatted query mean it is valid?

No. Formatting does not check table names, data types or whether the query will run.

Can formatting change my comments?

The formatter tries to retain comments, but spacing around them can change. Review the result before use.

Page updated · Project managed by Tony Hines · Report a problem with SQL Formatter