Beautify SQL queries with clean indentation and uppercase keywords.
🔒 100% client-side — a generic ANSI SQL formatter. Keywords are capitalized; indentation follows clause hierarchy.
A wall of minified SQL — copied from a log, a query plan, or a colleague's Slack message — is nearly impossible to read. This formatter re-indents the query so each clause sits on its own line, subqueries and parenthesised groups are indented, and keywords are capitalised. Paste messy SQL, get readable SQL, instantly.
The formatter tokenises the query (respecting string literals so 'WHERE' inside a string is not mistaken for a keyword), then re-emits it clause by clause. Top-level keywords like SELECT, FROM, WHERE, GROUP BY,ORDER BY, LIMIT, JOIN, and ON each start a new line; columns after SELECT and conditions after WHEREwrap with commas on their own line. The result is the canonical "vertical SQL" layout that most teams use in code reviews.
Format expands the query for human reading. Minify does the reverse: it collapses whitespace and newlines into a single line, which is useful when you need to embed a query in a JSON payload, a URL parameter, or a log line where newlines would break the surrounding format. Toggle between the two as needed — both preserve string literals exactly.
The formatter targets generic ANSI SQL, so it works across MySQL, PostgreSQL, SQLite, SQL Server, and Oracle for everyday queries. It does not deeply understand dialect-specific procedural extensions (PL/pgSQL blocks, T-SQL variables, Oracle PL/SQL), so deeply nested procedural code may not indent perfectly. It is a formatter, not a validator — it will happily re-indent a query that has a syntax error, because it does not run the query or check grammar. For validation, run the formatted output against your actual database.
The SQL Formatter handles sql formatterdirectly in your browser. Paste or type your input, and the tool processes it instantly — no upload, no signup, no waiting. It's built for the moments when you need a quick transformation and don't want to leave your workflow.
Because the tool runs client-side, it's fast and private. Your text never touches a server, which makes it safe for sensitive content. The interface is keyboard-friendly and works on any device with a modern browser.
Common uses: people reach for this tool when they need to use a sql formatter with indentation online, beautify select query, sql keyword capitalizer, or format mysql postgresql query online.
Browser-based tools like this one have a few real advantages over installed software or manual methods:
More tools you might find useful