The quick answer

Paste SQL, pick MySQL, PostgreSQL or SQLite, and the validator parses the whole statement offline, reporting syntax errors with exact line and character position. It checks grammar, not data or permissions — 100% client-side, so production queries never leave the tab.

The error message you get at the worst possible time

Runtime is a terrible place to learn about a syntax error. The migration window opens at 2 a.m., the script has been reviewed twice, and the database's answer to your 400-line ALTER sequence is a laconic error with a position number and nothing else. You count characters in the dark and find the trailing comma.

The syntax-check niche has been quietly underserved forever: formatter sites will happily reformat your SQL and silently fail on the broken parts, and 'paste it into a scratch database' is advice that assumes you have a scratch database, credentials, and patience. A validator page that reports exact error positions for three major dialects, offline, fills the actual gap.

What validation means on this page

This validator answers the syntax question completely and offline: no connection means no credentials to manage, no risk of accidentally running the DELETE you meant to lint, and no possibility that checking a query disturbs anything. Semantic checks belong to your database's own tooling — the only party that knows the truth.

In practice, syntax is also where most late-caught errors live. Trailing commas before a closing parenthesis, unbalanced quotes, an alias that happens to be a reserved word, backticks in a Postgres script — every one of these is a full runtime failure that a parse would have caught in milliseconds. The validator catches the class of error that is embarrassing precisely because it was always checkable.

Checking a query, start to finish

  1. Paste your SQL

    A single statement or a semicolon-separated script. Comments in all the usual styles survive and are attributed to the right statement.

  2. Confirm the dialect

    Auto-detect scores MySQL, PostgreSQL, and SQLite fingerprints in your text and proposes the strongest match; override if you know better. Dialect matters — the same text can be valid MySQL and invalid Postgres.

  3. Read the verdict

    Valid means every statement parsed under the chosen grammar. Invalid lists each error with statement number, line, column, the offending token, and a one-line explanation of what the grammar expected at that point.

  4. Fix and re-check

    The validator re-parses on every keystroke, so the error list updates as you edit. When it goes quiet, your syntax is clean in that dialect — semantic questions are then a matter for the database.

Four steps, no account, no connection, no file to install. Paste the SQL, confirm the dialect, read the verdict, fix and re-check — the parser re-runs on every keystroke, so the error list updates as you edit, closer to a spell checker's red squiggle than a compile step.

How the validator reads your SQL

tokenize(text)  ->  [ {kind, value, line, col}, ... ]
parse(tokens, dialect)  ->  AST | Error{token, expected}

on Error:
  statement index  = count of ';' before error token
  line / column    = token position
  hint             = rule table lookup(token.kind, expected)

Four queries it catches, with exact positions

Every error class below appears constantly in the wild — a trailing comma, an unclosed parenthesis, backticks in a Postgres script, a reserved word as an alias — and each is caught here in the time it takes to paste. Count the columns yourself on the first example: the error position is exact, not approximate.

SELECT name, FROM users;
The trailing comma

Input

SELECT name, FROM users;

Output

Line 1, column 14: expected an expression, found keyword FROM. The comma at column 13 promises another column; either add it or delete the comma.
SELECT id FROM users WHERE (role = 'admin' AND active = 1;
The unclosed parenthesis

Input

SELECT id FROM users WHERE (role = 'admin' AND active = 1;

Output

Line 1: parenthesis opened at column 31 never closes. The semicolon arrives while the expression is still open — add ')' before the semicolon, or remove the '(' if grouping was not intended.
SELECT `id`, `name` FROM users;
Backticks in the wrong dialect

Input

Dialect: PostgreSQL — SELECT `id`, `name` FROM users;

Output

Line 1, column 8: unexpected token '`'. PostgreSQL quotes identifiers with double quotes ("id"), not backticks; backticks are MySQL's delimiter.
SELECT total order FROM invoices;
The reserved word as alias

Input

SELECT total order FROM invoices;

Output

Line 1, column 14: 'order' is a reserved word in this dialect and cannot be an unquoted alias. Write AS total_order, or quote the identifier.

The fourth case deserves special affection, because it is the one engines report worst: several databases will accept `order` as an alias in some contexts and reject it in others, making the bug intermittent by construction. A grammar check applied uniformly catches it every time, which is what grammar checks are for.

Count the character columns yourself on the first example — `SELECT name, ` is thirteen characters, so FROM begins at column 14, exactly where the error points. That precision is not a nicety; it is the difference between an error report you act on and an error report you re-derive.

The dialect matrix

Most 'invalid SQL' turns out to be valid SQL in the wrong accent. The table below is the compatibility cheat sheet the validator effectively enforces — the places where MySQL, PostgreSQL, SQLite and T-SQL disagree on spelling, from quoting styles to the three genuinely different upsert models.

FeatureMySQLPostgreSQLSQLiteT-SQL
Identifier quoting`backticks`"double quotes""double quotes"[brackets]
Row limitLIMIT 5LIMIT 5LIMIT 5TOP 5 / FETCH FIRST 5
Auto-increment DDLAUTO_INCREMENTGENERATED ... AS IDENTITYINTEGER PRIMARY KEYIDENTITY(1,1)
String concatenationCONCAT(a, b)a || ba || ba + b
NULL fallbackIFNULL(a, b)COALESCE(a, b)IFNULL / COALESCEISNULL(a, b)
Boolean literalsTINYINT 0/1true / falseINTEGER 0/1BIT 0/1
UpsertON DUPLICATE KEY UPDATEON CONFLICT DO UPDATEON CONFLICT DO UPDATEMERGE
Where the dialects disagree — the source of most cross-dialect syntax failures.

The upsert row earns its place at the bottom of that table as the most-migrated feature in practice, because the three spellings are not stylistic variants — they encode genuinely different conflict-resolution models. MySQL's ON DUPLICATE KEY UPDATE fires on any unique-key collision; Postgres and SQLite's ON CONFLICT let you name the exact constraint in conflict; T-SQL's MERGE has semantics of its own and a documented list of caveats longer than the syntax. When a converted script validates but behaves differently in production, this row is usually the reason — the grammar agreed, the meaning did not.

What syntax-valid does not mean

A passing grade from this tool has a specific scope, and overselling it would get someone hurt. It proves the grammar, nothing more: no schema awareness, no type checking, no permission modeling. 'SELECT color FROM users' validates even if the users table has no color column — only your database knows that.

  • No schema awareness. `SELECT color FROM users` validates even if users has no color column. Column and table existence are semantic facts; only your database knows them.
  • No type checking. Comparing a string to an integer in a WHERE clause parses fine everywhere and means something different in each engine.
  • No permission modeling. A query can be valid for the dialect and still fail at runtime for grants, locks, timeouts, or resource limits.
  • False negatives on exotic syntax. Vendor extensions outside the parser's grammar — certain JSONB operators, procedural blocks, some ANALYZE and VACUUM spellings — can be rejected despite being legal. When the validator disagrees with a database that accepted the query, the database wins.

Stating the boundary this plainly is also what keeps the tool honest — a validator that implies more knowledge than it has is worse than no validator, because its verdicts start substituting for thinking instead of accelerating it.

Validator versus a scratch database versus formatter sites

ApproachCatches syntax errorsError positionSetupRisk of running your SQL
This validatorYes, at parse timeExact line, column, tokenNone — paste and goZero — nothing executes
Scratch databaseYes, at run timeEngine-dependent, often vagueInstall, credentials, seed dataNonzero — you are connected to something that can execute
Formatter sitesIncidentally — formatting fails silently or half-appliesRarely reportedNoneUploads your SQL to their server
Asking an AI checkerSometimes, with invented confidenceApproximate at bestNoneQuery text leaves your machine
Ways to check SQL before it meets a database.

The AI row is included with respect and one caveat: probabilistic checkers can be genuinely helpful for explanation, but their verdicts on syntax arrive with unearned confidence, including inventing rules that exist in no dialect. When the answer needs to be exact — and syntax is nothing if not exact — a parser with a grammar is the right instrument.

Offline by architecture

The offline property is a direct consequence of doing parsing instead of execution. A tool that runs queries needs a database somewhere; a tool that needs only a grammar needs nothing but the page. It works on a plane, inside a customer network with no outbound access, and on machines where installing a scratch database is a four-week procurement conversation.

There is also a quiet speed argument: no network round-trip means validation latency is parser latency, single-digit milliseconds even for long scripts. The error list updates as you type, which changes the editing rhythm from paste-pray-fix to something closer to a spell checker's red squiggle — immediate, ignorable when clean, pointed when not.

Frequently asked questions

Which SQL dialects can it validate?

MySQL/MariaDB, PostgreSQL, SQLite, and common T-SQL. You can pin the dialect manually or let the auto-detector guess from syntax fingerprints — backticks suggest MySQL, double-quoted strings in Postgres, IFNULL versus COALESCE, LIMIT versus TOP. The detector shows its reasoning so you can overrule it with one click.

Does it check that my tables and columns exist?

No — that is semantic validation, and it requires a live schema to validate against. This tool checks syntax: does the query parse cleanly in the chosen dialect? A query referencing a table that does not exist anywhere will validate perfectly, because structurally it is a well-formed query. The trade is deliberate: syntax checking needs no connection, no credentials, and no risk.

Why did my definitely-valid query fail?

Almost always a vendor extension the parser's grammar does not cover — PostgreSQL's JSONB operators like @> and #>>, exotic ANALYZE syntax, or a stored-procedure body in a nonstandard dialect. The validator's failure mode on such queries is a false negative: it says invalid when the database would accept it. When that happens, pin the dialect explicitly and retry; if it still objects, treat the verdict as 'unverified' rather than 'broken.'

Does the validator execute anything?

No. Parsing is a read-only analysis of text; the query is never sent to a database, never run, and cannot touch data. A syntactically perfect DELETE validates identically to a syntactically perfect SELECT — the tool has no idea and no need to know what the statement would do if executed.

Sources and further reading

Sources and further reading

We cite primary sources (standards bodies, government agencies, official documentation) wherever they exist so you can verify every number on this page yourself.