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

Basic Knowledge

What Does SQL Formatting Align?

SQL formatting aligns the capitalization of keywords like SELECT and WHERE, line breaks between clauses, and indentation based on nesting depth according to consistent rules. The query behavior remains unchanged; only readability improves.

Why Format SQL?

A long SQL query written on a single line is difficult to follow—it's hard to identify where conditions end and joins begin. Adding line breaks and indentation by clause makes it easy to quickly grasp the query's intent during code reviews and troubleshooting.

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.

Follow RAKKOTOOLS on Google Search

175 useful tools become easier to find from Google Search and AI Search!

  • Found in search
  • Also shown in AI Search
  • Discover new tools
Related Tools