SQL Formatter

Format SQL statements for better readability

Features

Five indent width options

Choose from 2-4 spaces, tabs, or minified output

Unify keyword casing

Convert all keywords to uppercase, lowercase, or capitalized

Set identifier casing too

Adjust the casing of table and column names separately

Text and file input

Supports both pasting and loading .sql files

How to use

1

Enter SQL statements

Paste directly into the text tab, or select a .sql file in the file tab

2

Set formatting options

Choose indent width, keyword casing, table/column name casing, and comment handling

3

Press the format button

Press the format button and the SQL is formatted with your settings and shown on the right

4

Copy or save the result

Copy the formatted code, or download it as a .sql file

Use cases

Streamline code reviews

Unify line breaks and indentation so diffs and syntax are easier to read

Standardize team coding conventions

Align keyword and identifier casing to standardize notation across the team

Make long queries readable

Break SQL crammed onto one line into a hierarchy to grasp subqueries and conditions

Minify to one line for logs

Compress formatted SQL to embed it in scripts or config files

Grasp structure while learning SQL

Format examples to visually understand clause boundaries and nested structure

Safety and privacy

Runs entirely in your browser

Your input data is processed only within your browser and is never sent externally.

Processing only in your browser

SQL formatting is processed entirely within your browser, and input data is not sent to any server.

Communications encrypted with HTTPS

Page loading is also encrypted by TLS, and content cannot be read by third parties.

No transmission to third parties

Input content is not sent to external services such as ad networks or trackers.

No automatic saving of results

the SQL you enter and input suggestions are not stored on the server.

Related Tools