SQL Formatter & Validator
Beautify or minify SQL, and check it for syntax errors with the exact line and column — for 20 dialects, entirely in your browser.
Everything runs in your browser — your SQL is never uploaded to any server.
Options
Drop a .sql or .txt file here, paste, or load a sample. Press Ctrl+Enter to run.
Syntax check
“Valid” means the syntax is correct for this grammar. The checker has no database schema, so it cannot tell whether tables or columns exist or whether the query will run. Dialect-specific or very new syntax may be rejected even though your database accepts it.
Format, minify and check SQL in your browser
Readable SQL is easier to review, debug and diff. This tool rewrites a query with consistent indentation, line breaks and keyword case, and understands the quirks of about twenty dialects, including MySQL, PostgreSQL, SQL Server (T-SQL), SQLite, BigQuery, Snowflake, Redshift, Oracle PL/SQL, Hive, Spark, Trino and DB2. Pick a dialect, choose two or four spaces or tabs, decide whether keywords, data types and function names are upper-case, lower-case or left alone, and move commas to the start of each line if that is your team's style.
The syntax check is the second half. Paste a script and every statement is validated separately, so you can see which ones pass and which fail. A failure shows the line and column, the offending token, a few lines of context and, where possible, a hint such as a misspelled keyword, a trailing comma or an unclosed parenthesis. Splitting is aware of strings, comments, backticks, square brackets and PostgreSQL dollar-quoted bodies, so a semicolon inside a literal never cuts a statement in half.
Minify does the opposite of formatting: it collapses whitespace and, if you wish, strips comments, to give you a compact single-line query for logs, config files or embedding in code. It works on tokens rather than on regular expressions, so text inside strings and quoted names stays exactly as written.
Be aware of the limits. A green check proves the syntax matches the selected grammar, not that your tables exist or that the query is fast or correct. Some dialects, procedural blocks and newest features are only partly supported, and a few dialects have no dedicated checker, in which case you can choose the closest grammar yourself. Everything happens locally, so you can safely paste production queries, and a large file simply pauses the live preview until you press a button.
Frequently asked questions
Does “valid” mean my query will run?
No. The checker verifies syntax only. It has no access to your database, so it cannot know whether a table or column exists, whether types are compatible or whether you have permission. It also uses its own grammar, so brand-new or vendor-specific syntax can be rejected even though your database accepts it. Treat a green result as “the SQL is well-formed”, and a red one as “look at this spot”.
Is my SQL uploaded anywhere?
No. Formatting, minifying and syntax checking all run in your browser, in a background worker. Nothing is sent to a server. The optional draft and your settings are kept only in this browser's local storage.
Why can the formatter succeed while the checker reports an error?
They are two different tools. The formatter only needs to recognise tokens and clauses, so it is forgiving. The checker uses a full grammar for the selected dialect and is stricter. When they disagree you get a warning: the result is still shown, but the flagged line deserves a look.
Does minify change what my query does?
It only removes whitespace and comments. Strings, quoted identifiers, dollar-quoted blocks and optimizer hints are copied character for character, and tokens that were touching stay touching. As a precaution, do not minify scripts that rely on line breaks, such as MySQL DELIMITER blocks.