SQL Formatter
Format and beautify SQL queries with uppercased keywords.
Examples
Format a one-line query
Input
select id, name from users where active = 1 order by name;
Output
SELECT id, name FROM users WHERE active = 1 ORDER BY name;
Break out a JOIN
Input
select * from a join b on a.id=b.a_id where b.ok=1;
Output
SELECT * FROM a JOIN b ON a.id = b.a_id WHERE b.ok = 1;
About this tool
This free online SQL formatter turns dense, one-line, or inconsistent queries into clean, indented SQL — a fast SQL beautifier and pretty-print tool with uppercased keywords. Paste your query, choose an indentation style, and the formatted result appears instantly. Everything runs in your browser with no upload, so your SQL never leaves your device.
How to use
- Paste your SQL into the input box (or click Sample to try it).
- Pick an indent of 2 spaces, 4 spaces, or a tab.
- Read the beautified query in the output box on the right.
- Copy the result with the Copy button.
When to use a SQL formatter
Formatting is helpful when you inherit a long query, copy SQL out of code or a log, or want to review a statement before running it. Clear clause breaks and consistent indentation make joins, filters, and grouping easy to follow and review.
Frequently asked questions
Is this SQL formatter free?
Yes — it's a completely free online SQL formatter and beautifier with no sign-up and no limits. Format and indent as many queries as you like.
Is my SQL uploaded to a server?
No. This is a no-upload tool — your SQL is formatted entirely in your browser, so the query never leaves your device. It's safe for private or production queries.
What does the SQL beautifier do?
It breaks a query onto clear lines by clause (SELECT, FROM, WHERE, JOIN, GROUP BY, and so on), indents nested parts, and uppercases keywords so dense one-line SQL becomes readable.
Can I choose the indentation?
Yes — pick 2 spaces, 4 spaces, or tabs. Your choice is remembered in your browser for next time.
Which SQL dialects does it support?
It formats standard SQL, which covers the vast majority of queries across MySQL, PostgreSQL, SQL Server, SQLite, and similar databases. It tidies layout and keywords rather than validating dialect-specific features.
Does it change what my query does?
No. Formatting only changes whitespace, line breaks, and keyword casing — the query logic and results stay exactly the same.
Does it work offline and on mobile?
Once the page has loaded it runs locally, so it keeps working on a flaky connection, and the layout is fully responsive on phones and tablets.
Learn more
Related tools
JSON Formatter
Format, validate, and beautify JSON instantly in your browser.
HTML Formatter
Beautify and indent messy or minified HTML in your browser.
CSS Formatter
Beautify and tidy messy or minified CSS in your browser.
JavaScript Formatter
Beautify and indent minified or messy JavaScript in your browser.