Want a Custom tool for Yourself?

Need a Custom Tool? We build custom tools that can save hours per employee per day.

SQL Formatter

Format SQL with consistent indentation and spacing. Paste your query, get readable output instantly, then copy it for review and debugging.

SQL Formatter



Last updated: April 7, 2026

Created by: Eon Tools Dev Team

Reviewed by: Sugam Baskota



What this does

So you have a SQL query that came as one long line, or that grew into a tangle of joins and conditions, and reading it means counting parentheses by eye. This formats it. Paste the query, click Format, and you get it back with each clause laid out and the keywords standing out.

How to use it

  1. Paste your SQL query into the box.
  2. Click Format.
  3. Copy the formatted query.

How it works

The formatting is done by a library called sql-formatter. It breaks your query onto multiple lines, indenting clauses so the structure is clear, and it puts the SQL keywords in uppercase, so the likes of SELECT, FROM, WHERE, and JOIN stand out from your table and column names. It runs in your browser, so your query, table names and all, is never sent away.

Why a formatted query helps

A formatted query is far easier to reason about. When SELECT, FROM, and each JOIN or WHERE sits on its own line, you can follow what the query is actually doing, spot a missing condition, or find the join that is causing trouble. Uppercase keywords are a long standing SQL habit for the same reason, they separate the language from your data at a glance.

A quick example

Here is a query as it might arrive:

select id, name from users where active = 1 order by name

And after formatting:

SELECT
    id,
    name
FROM
    users
WHERE
    active = 1
ORDER BY
    name

It is the same query, just laid out so you can read it. Worth noting that this tidies the text, it does not run or check your query against a database, so it will format something even if a table name is wrong.

Questions people ask

Does formatting change what my query does?

No. It only changes the layout and the case of keywords. The query runs exactly as it did before.

Why are the keywords in capitals?

The formatter uppercases SQL keywords by convention, so they stand out from your table and column names and the query is easier to read.

Does it check whether my query is valid?

No. It formats the text only. It does not connect to a database or verify that your tables and columns exist.

Is my query uploaded anywhere?

No. It runs entirely in your browser, so the query you paste stays on your machine.

References

  1. Simon Holywell. SQL Style Guide. https://www.sqlstyle.guide/


Sugam Baskota

Sugam Baskota is a senior software engineer and Computer Science graduate from UT Arlington, with interests in user scripts, browser extensions, developer tooling, and productivity systems. He spends time building practical utilities and extensions in the kinds of workflows Eon is designed to simplify. At Eon Tools, he reviews useful, password, and developer tools.