#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
⚡ FREE · RUNS IN YOUR BROWSER

SQL Formatter: Make Long Queries Easy to Read

Turn a one-line SQL query into clean, indented code.

  • 📐 Clean indentation
  • 🔠 Keyword case control
  • 🔒 Query never leaves your browser

How to use the SQL Formatter

  1. 1. Paste your SQLAdd one query or several, separated by semicolons.
  2. 2. Set your styleChoose keyword case and 2 or 4 space indents.
  3. 3. Copy the resultCopy the formatted query or download it as a .sql file.

What good SQL formatting looks like

A readable query puts each main clause on its own line, so you can scan it the way you read a report. For example, this:

select id, name from users where city = 'Noida' and active = 1 order by name

becomes this:

SELECT
  id,
  name
FROM
  users
WHERE
  city = 'Noida'
  AND active = 1
ORDER BY
  name

Subqueries are indented one step further, joins sit inside the FROM block, and CASE statements get a line for each WHEN. Lists inside brackets, such as function arguments and IN lists, stay on one line to keep things short.

What this tool will not change

Only spacing and keyword case change. Text in quotes, quoted column names and comments stay exactly as written, so 'select from' inside a string is left alone. Table and column names keep the case you typed.

The tool does not connect to any database and does not run your query. That also means it cannot tell you if a query is wrong, only make it easier to spot the problem yourself. An unclosed quote is the one error it does catch, with the line and column.

MySQL users who write \' inside strings should tick the backslash option. Exported the results as JSON? Move them to a spreadsheet with the JSON to CSV converter, or tidy them with the JSON formatter.

Frequently asked questions

Which SQL dialects does it support?

It works on common SQL used in MySQL, PostgreSQL, SQL Server, SQLite and Oracle, because it focuses on layout, not on one dialect's rules.

Is my query sent to a server?

No. It is formatted in your browser and never runs on any database.

Will it change my data or logic?

No. Only spaces, line breaks and keyword case change. Strings and comments stay the same.

Is this tool free?

Yes, it is free. We ask for your name and WhatsApp number once when you see your result, and other Uncodemy tools then open without the form.

More free tools

See all free tools