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

SQL Formatter

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

220 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

RAKKOTOOLS is free to use!

Available free of charge for individuals and corporations, commercial and non-commercial use alike.No prior permission or usage application is required. Feel free to use it in various situations.

  • Use in streaming and videos

    Use various tools such as lottery draws and raffles in live streams and videos.

  • Use in schools, work, and events

    Can be used in various situations such as classes, team division, internal work, and events.

  • Introduction on Web, books, and SNS

    Feel free to introduce it as a useful tool on web media, books, SNS, and other platforms.

  • Commercial use

    Can be used for commercial purposes such as research, calculation, processing, and conversion in business and production.

If you mention it, I get motivated to create more tools!

If using in streaming and videos

Link to RAKKOTOOLS in the description, or Mention or display that you are using RAKKOTOOLS in the stream or video.

Credit example for the description

RAKKOTOOLS https://rakko.tools/en

Usage guidelinesYou are free to use it for normal purposes. However, use for purposes that violate laws, infringe on third-party rights, impose significant load on the service, or otherwise interfere with service operation is prohibited.

We do not guarantee the accuracy or completeness of information and calculation results obtained from each tool.

This notice is a translation of the original Japanese text. If there is any discrepancy between the translation and the original, the Japanese original takes precedence.