SQL Validator — Check SQL Syntax Online

Validate SQL syntax for MySQL, PostgreSQL, SQLite, and SQL Server instantly. Paste your SQL and get error locations and explanations. 100% browser-based.

Your SQL

How it works

About SQL Validation

SQL validators use a parser to read your SQL statement and check it conforms to the grammar rules of your target database. Unlike running EXPLAIN or DESCRIBE, this works without a live database connection and catches purely syntactic errors — missing keywords, mismatched parentheses, invalid identifiers — before you even try to run it. Use this to quickly check a query before pasting it into your application code, or to learn SQL by seeing immediate feedback on mistakes.

Note: a valid SQL statement doesn't mean the query is correct or efficient — check that your column and table names match your schema, that the logic does what you intend, and that you have appropriate indexes for any WHERE clauses. For performance, use EXPLAIN on a real database.

Supported Dialects

Dialect Notes
MySQL USE, LIMIT variations, backtick identifiers
PostgreSQL SERIAL, RETURNING, dollar-quoted strings, PSQL-specific syntax
SQLite AUTOINCREMENT, affinity rules, limited ALTER TABLE support
SQL Server TOP vs LIMIT, nvarchar literals, square-bracket identifiers

This is a heuristic linter, not a parser

The implementation is a tokenizer followed by a small set of structural checks, and being precise about that matters. There is no grammar, no symbol table and no schema, so the tool cannot tell you a column does not exist or that two types are incompatible — it reports positions and phrases, not semantic errors. What it does check is unbalanced parentheses in both directions, a `WHERE`, `GROUP` or `ORDER` with no `SELECT` anywhere before it, and a statement whose first recognised keyword is not a statement starter.

That last check is weaker than it sounds, because the test is presence rather than position: a `SELECT` anywhere earlier in the token stream satisfies it, so `WHERE x = 1 SELECT 1` passes. Error positions are approximate too — line numbers only advance when a token itself contains a newline, and the column counter accumulates token lengths across the statement rather than resetting per line, so treat the reported position as a region to look at rather than an exact caret.

Dialect differences are a word blacklist

There is no per-dialect grammar. Each dialect carries a short list of individual words that are wrong for it, and the check matches a token against that list rather than parsing anything: MySQL rejects `SERIAL`, `RETURNING`, `::` and `CURRENT_SCHEMA`; PostgreSQL rejects `AUTO_INCREMENT`; SQLite rejects `RETURNING`, which it only gained in 3.35; SQL Server rejects `LIMIT` and `SERIAL`. Deliberately absent are `NOW()` and `GETDATE()` — both are ordinary functions in MySQL and SQL Server, and flagging them would be a false positive rather than a warning.

Matching on the token instead of searching the raw statement matters for two reasons. A word inside a string literal or a comment no longer triggers, because the tokenizer has already classified it as text rather than a keyword. And a single occurrence produces one report rather than one per word in the query, so the output no longer needs deduplicating before you read it. The trade-off is narrower coverage: a blacklist that only matches whole words cannot see multi-word shapes, so anything depending on a phrase is not checked at all.

Known blind spots, and how to use the output

Only `--` comments are skipped. `#` comments and `/* */` blocks are not recognised, so a commented-out query in a block comment is tokenised as live SQL and can produce errors for code that is not running. String scanning follows the JavaScript convention of a backslash before the closing quote rather than SQL's doubled quote, so `'it''s'` — valid SQL — is read as two adjacent literals, and an unterminated string swallows the remainder without an error.

The Format button here is regex-based rather than token-based: it upper-cases keywords with word-boundary patterns and inserts newlines by substituting whitespace before a keyword, which will break a line inside a string literal or a comment. That is precisely the failure the dedicated SQL formatter exists to avoid — use this page for structural checks and the formatter for layout. A clean run means no unbalanced parentheses and no obvious keyword mismatch; it does not mean the query is correct, efficient, or runnable.

Frequently Asked Questions

How do I validate SQL syntax online?
Select your SQL dialect (MySQL, PostgreSQL, SQLite, or SQL Server), paste your SQL query, and the tool checks it for syntax errors immediately. It supports DDL statements, SELECT/INSERT/UPDATE/DELETE, JOINs, subqueries, and window functions.
Which SQL dialects are supported?
MySQL 8.0, PostgreSQL 15, SQLite 3, and SQL Server 2019 are supported. Each dialect uses its own grammar rules, so a query valid in PostgreSQL might flag an error in MySQL.
Is my data sent to a server?
No. Every tool on jsonversal runs entirely in your browser using the Web Crypto API, File API, and Clipboard API. Nothing is ever uploaded — not even the JSON you paste in.
Do I need an account or API key?
No signup, no email, no API key. All tools are free to use with no signup required.
Can I use these tools offline?
Yes. Once the page loads, all tools work offline. There are no external API calls or CDN dependencies at runtime.
🔒
Your data never leaves your device

All processing happens in your browser. No uploads, no tracking, no servers. Your API keys, configs, and private payloads stay private — 100% client-side.

esc
↑↓ navigate ↵ open esc close