SQL Formatter
FreeReformat a SQL query for readability with consistent indentation, one clause per line, and your choice of keyword capitalization, across more than a dozen SQL dialects including MySQL, PostgreSQL, SQLite, T-SQL, PL/SQL, BigQuery, and Snowflake, all running entirely in your browser.
Runs entirely in your browser. Your SQL is never uploaded anywhere.
Recent Activity
Visible to everyone. Last 20 uses across all visitors, newest first.
Formattata una query MySQL (253 caratteri)
3 hours ago
Formatted a MySQL query (21 chars)
4 hours ago
Formatted a MySQL query (253 chars)
4 hours ago
Formatted a MySQL query (253 chars)
4 hours ago
Formatted a MySQL query (253 chars)
4 hours ago
Formatted a MySQL query (253 chars)
4 hours ago
Formatted a MySQL query (253 chars)
4 hours ago
Formatted a MySQL query (21 chars)
4 hours ago
Formatted a MySQL query (253 chars)
4 hours ago
Formatted a MySQL query (253 chars)
4 hours ago
Formatted a MySQL query (253 chars)
4 hours ago
Formatted a MySQL query (253 chars)
4 hours ago
Formatted a MySQL query (253 chars)
4 hours ago
Formatted a MySQL query (253 chars)
4 hours ago
Formatted a MySQL query (21 chars)
4 hours ago
Formatted a MySQL query (253 chars)
4 hours ago
Formatted a MySQL query (253 chars)
4 hours ago
Formatted a MySQL query (253 chars)
4 hours ago
Formatted a MySQL query (253 chars)
4 hours ago
What this tool does
This tool reformats a SQL query for readability: consistent indentation, one clause per line, and your choice of keyword capitalization, across more than a dozen SQL dialects including MySQL, PostgreSQL, SQLite, T-SQL, PL/SQL, BigQuery, and Snowflake.
How It Works
Your SQL is parsed into a syntax tree using the grammar of the dialect you select, the same way a real database driver would need to understand the query's clauses, expressions, and nesting. That tree is then printed back out as text using consistent rules: one top-level clause (SELECT, FROM, WHERE, and so on) per line, nested expressions and subqueries indented one level deeper than their parent, and every keyword rewritten in the case you chose (uppercase, lowercase, or left exactly as typed). Because the output comes from re-printing the parsed structure rather than editing the original text, the result is always a complete, valid representation of the same query.
Problems it solves
- Turning a dense, single-line query (common in exported logs or minified application code) back into something readable.
- Keeping a consistent SQL style across a team or codebase without manually reformatting every query.
- Spotting a genuine syntax error early, since the parser will reject a query that would also fail against a real database.
- Reviewing a long query with many joins and subqueries more easily once it is properly indented.
Frequently asked questions
›Why does it matter which SQL dialect I pick?
Different database engines use slightly different syntax for things like string concatenation, quoting identifiers, or window functions, and a formatter needs to understand those differences to indent and break lines correctly; picking the dialect that matches where you will actually run the query, such as MySQL, PostgreSQL, or T-SQL, gives the most accurate and readable result.
›My query failed to format, is something wrong with my SQL?
Usually yes: this tool actually parses your SQL to understand its structure before reformatting it, so a genuine syntax error (an unmatched parenthesis, a missing keyword) will be caught here the same way it would be caught by the database itself, and the error message tells you roughly where the parser got stuck.
›Does formatting change what my query does?
No, formatting only changes whitespace, line breaks, and the capitalization of keywords, never the actual tokens, literals, or structure of the query, so a formatted query always behaves identically to the original when run against a database.
›What does "Preserve case" do for keywords?
It leaves every keyword exactly as you typed it (so SELECT, select, and Select all stay as written) instead of forcing them all to uppercase or lowercase, useful if your team already has a house style you do not want this tool to override.
›Can I format more than one statement at once?
Yes, paste multiple semicolon-separated statements and each one is parsed and formatted independently, with blank lines inserted between them so a whole migration file or script stays readable.
Related Tools
Text
Cron Expression Generator
Build and parse cron expressions with a live field editor, plain-English description, and the next 5 actual run times. Supports presets, @ shortcuts, and the optional 6-field seconds variant.
FreeText
DMARC Record Generator
Build a DMARC DNS record from plain-language fields, with staged rollout presets and a live enforcement-level indicator.
FreeText
Excel To HTML Table Converter
Paste from Excel or Google Sheets, or upload a .xlsx/.xls/.csv file, and get a clean HTML table with a live preview, optional styling, and numeric column alignment.
FreeText
Hash Generator (MD5/SHA1/SHA256/SHA512)
Hash text or a file into MD5, SHA-1, SHA-256, SHA-384, SHA-512, SHA3-256, SHA3-512, RIPEMD-160, and CRC32 all at once, with a compare field to check against a known checksum.
FreeText
htpasswd Generator
Generate a real Apache .htpasswd file with bcrypt or SHA, verified byte-for-byte against the official htpasswd command-line tool, with support for multiple users at once.
FreeText
HTML Entity Converter
Convert text to and from HTML entities in both directions at once, with decimal or hexadecimal numeric formats and a quick-reference table of common entities.
FreeText
HTML Validator
Check HTML for unclosed tags, duplicate IDs, deprecated elements, and other common well-defined issues, verified with its own tag-matching parser, not a full W3C conformance validator.
FreeText
IPv4 To IPv6 Converter
Generates IPv4-mapped, IPv4-compatible, 6to4, and NAT64 IPv6 representations of an IPv4 address, and extracts the IPv4 address back out of any of those IPv6 forms.
Comments (0)
Found this tool useful? Leave a comment, share a tip, or tell us how we can make it better.
No comments yet. Be the first to share your thoughts!