Loading tool…
Paste a messy SQL query to reformat it with consistent keyword casing and indentation. Great for cleaning up one-line queries from logs and ORMs.
Loading tool…
SQL Formatter is a free, private online tool that lets you beautify and indent SQL queries with keywords on new lines for readability. It runs entirely in your browser, so nothing you enter is uploaded to a server.
Privacy: this tool runs entirely in your browser. Your input is never sent to, received by, or stored on any server — there are no uploads and no tracking of what you enter.
Readable SQL is easier to review, debug and maintain. This formatter puts major clauses (SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY) on their own lines and indents conditions and column lists.
It normalises keyword casing to uppercase, breaks the query into logical lines, and indents AND/OR conditions and selected columns so the structure is clear at a glance.
It's a lightweight client-side beautifier ideal for SELECT/INSERT/UPDATE/DELETE statements. For dialect-specific linting, pair it with your database's own tools.
A SQL formatter takes a messy, one-line or inconsistently-spaced SQL query and rewrites it with clean indentation, line breaks and consistent keyword casing. Readable SQL is far easier to review, debug and maintain - the difference between a wall of text and a query whose structure you can grasp at a glance.
The tool normalises keyword casing to uppercase and places the major clauses - SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY - on their own lines, then indents the items beneath them, such as selected columns and AND/OR conditions. The result follows the conventional layout most teams and style guides expect.
SQL pulled from application logs, ORMs or minified scripts often arrives as a single dense line. Reformatting it reveals the query's logic - which tables are joined, what is filtered, how it is grouped - making bugs and performance issues much easier to spot. It also makes queries easier to diff in code review and to hand over to teammates.
The formatter only adjusts whitespace and keyword casing - it never alters the meaning or logic of your query, so the reformatted SQL returns exactly the same results. It is a presentation tool, not a query rewriter or optimiser.
Paste a query and the formatted version appears instantly. It works with the standard clauses common to MySQL, PostgreSQL, SQL Server and SQLite. For dialect-specific linting or optimisation, use your database's own tooling, but for everyday readability this is the quick fix. Everything runs in your browser, so even queries against sensitive schemas stay private.