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.
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.
Paste a query above and the formatted version appears here.
- Runs in your browser
- No account required
- Free to use
How it works
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.
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.
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.
Related tools
JSON Formatter
Format and minify JSON, with errors that name the line.
Runs entirely in your browser
Open toolJSON Validator
Check JSON and get the line, column and cause of any error.
Runs entirely in your browser
Open toolJSON Viewer
Explore JSON as a collapsible tree instead of scrolling it.
Runs entirely in your browser
Open toolJSON to CSV
Turn an array of objects into a spreadsheet-ready CSV.
Runs entirely in your browser
Open toolWho 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.
Web Design
Custom, conversion-focused web design that captivates visitors and turns them into paying customers. Mobile-first, fast, and built to rank.
Web Development
Custom WordPress websites built with clean code, blazing-fast performance (Core Web Vitals optimised), and enterprise-grade security.
E-Commerce
Online stores that convert visitors to customers with seamless shopping experiences.
SEO
Technical SEO, keyword research, on-page optimisation and local SEO strategies that drive qualified organic traffic.
Digital Marketing
Data-driven campaigns that deliver measurable ROI across every channel.
Branding
Memorable brand identities that stand out in any market and build lasting trust.
Website Help
One-on-one expert support for bug fixes, updates and ongoing maintenance — without a long-term retainer.
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.