Code & Data

Format a SQL query so you can read it

Paste a query to lay it out: each clause on its own line, contents indented, joins aligned, and AND or OR hanging under the condition they extend.

or paste your own — nothing is uploaded.

The query is laid out, not parsed — there is no dialect, no schema and no validation, because every SQL dialect differs enough that parsing one would mean picking a side. String literals and comments are never touched.

Formatted SQL

Paste a query above and the formatted version appears here.

  • Runs in your browser
  • No account required
  • Free to use

How it works

01

Tokenised, so a literal is never mistaken for a keyword

`WHERE name = ‘select from’` contains two clause names inside a string. A formatter that matches keywords in the raw text breaks that query. Splitting the statement into tokens first means a string, a quoted identifier and a comment are all opaque and cannot be reformatted from the inside.

02

Laid out, not parsed

There is no attempt to understand the query — no dialect, no schema, no validation. Every SQL dialect differs enough that parsing one properly would mean picking a side, and layout is all a formatter needs. That also means it will format a query for a database it has never heard of.

03

Parentheses add a level

A subquery is indented inside its brackets, so nesting is visible. A parenthesis that stays on one line does not force a break, which keeps a function call from being spread over four lines.

What it does

Keyword casing

Uppercase by default, which is the near-universal convention for making the shape of a query readable at a glance. It can be turned off.

Joins and conditions

Joins align with the clauses and keep their ON condition on the same line; AND and OR indent under the clause so a long WHERE reads as a list.

One-line mode

Collapses a formatted query back onto a single line — useful for pasting into code or a log — with string literals kept exactly as written.

Nothing is uploaded

Queries carry table names, column names and sometimes real values. This one is formatted in your browser and never uploaded.

Practical advice

Getting a better result

  • Formatting an unfamiliar query before reading it is the fastest way to see its shape — which tables, which joins, which conditions.
  • The formatter does not validate. A query it lays out neatly can still be wrong, and one it lays out oddly may just use syntax it does not recognise.
  • Comments are preserved and stay on their own lines, so annotated queries survive formatting.

Questions

Things people ask

Which SQL dialects does it support?

All of them, in the sense that it never parses one. It recognises the clause keywords that are common across dialects and lays the statement out around them, so a PostgreSQL, MySQL, SQL Server or SQLite query all format sensibly. Dialect-specific syntax it does not recognise is passed through rather than mangled.

Does it check my query for errors?

No. It is a formatter, not a linter or a parser. A syntactically invalid query will still be laid out.

Will it change anything inside my strings?

No. String literals, quoted identifiers and comments are identified before any formatting happens and are copied through byte for byte.

Who builds these

Free tools by day. Websites that earn their keep by trade.

KuConvert is built by KUDUY, a web design and development agency. From custom WordPress builds to SEO and e-commerce, everything they do is engineered to bring you more qualified traffic and turn it into revenue.

  • Fixed scope, no surprise invoices

    Most sites ship in four to eight weeks with the scope and the price agreed up front.

  • SEO from day one

    Search is designed into the build — structure, schema and Core Web Vitals — not retrofitted.

  • A team, not a ticket queue

    A project manager, a designer and a developer you can actually reach.

Need your whole site to load this fast?

Images are usually the heaviest thing on a page and the easiest win. KUDUY works on site speed, image delivery and Core Web Vitals for teams who would rather not do it by hand.

This tool runs entirely in your browser. Your files are never uploaded.