DO IT EASY APP
English

SQL formatter

Turn a one-line SQL query into readable code: uppercase keywords, clauses on separate lines, indented.

  • No sign-up, no fees.
  • Turns one-line SQL into readable code.
  • Uppercase keywords, clauses on separate lines.
  • Subqueries and AND/OR are indented.
  • Leaves strings and comments alone.
  • What you type is processed, but never shared with anyone.

How to use the SQL formatter

The query you copied from a log is a single line and impossible to grasp at a glance. Three steps:

  1. Paste the query. Put it into the SQL query box.
  2. Adjust. Choose 2 spaces, 4 spaces or a tab for the indent; turn uppercase keywords on or off.
  3. Copy. The formatted query appears below; take it with Copy.

What is SQL formatting?

SQL formatting makes a query easier to read without changing what it means: clauses like SELECT, FROM and WHERE move to their own lines, selected columns line up one per row and conditions are indented. In a long query that makes it easier to see which table is joined where. The database runs the query the same way; the difference is only for whoever reads it.

What you need to know

  • The tool only tidies the text; it doesn't run the query or validate its syntax.
  • Text in quotes ('hello') and comments (-- note, /* note */) is left alone; words inside them don't count as keywords.
  • The AND inside BETWEEN a AND b isn't split onto a new line.
  • Syntax specific to one SQL dialect may not format perfectly; check the result.

Tips

Frequently asked questions

Is SQL formatting free?

Yes, it's free with no sign-up.

Is my query executed?

No. The text is only tidied in your browser; no database is ever contacted.

Which SQL dialects does it support?

It's designed for general SQL (MySQL, PostgreSQL, SQL Server, SQLite and so on). Advanced dialect-specific syntax may not format perfectly.

Do keywords have to be uppercase?

No, SQL is case-insensitive. Uppercase is only a convention for readability; if you turn the box off they stay as written.

Are my queries sent anywhere?

What you type is processed, but never shared with anyone.

Can I use it on my phone?

Yes.

Related tools