JavaScript Validator
Check whether JavaScript can be parsed—without running it. See the exact line and column, a pointer to the code, and a careful hint when the parser can identify a likely cause.
Syntax checking, not code execution
Find parse errors before you run or ship a JavaScript file.
The validator uses the Acorn JavaScript parser to check whether your input follows the selected ECMAScript version. If it finds an error, it shows the message, line and column, a small code frame, and a button that selects the reported position in your input.
In Auto-detect mode, it tries regular Script syntax first, then Module syntax. That helps it recognize top-level import, export and module-only await without making you guess the mode.
Valid syntax does not guarantee correct behavior. This tool never executes your code and does not check runtime errors, variable types, security, or style. It also does not parse TypeScript or JSX.
For an error hint, it only gives a likely explanation when the parser message provides a useful clue. Suggestions are not automatic fixes: review the code before changing it.
Choose the JavaScript syntax to check
Use the mode and version your project expects.
| Setting | What it means |
|---|---|
| Auto-detect | Try Script first, then Module. The result tells you which form parsed successfully. |
| Script | Classic JavaScript files and browser scripts. Top-level import/export statements are not allowed. |
| Module | ES modules with import/export. Supports module-only syntax such as top-level await in compatible versions. |
| Latest | Use the newest syntax supported by the parser bundled with this page. |
| ES5–ES2026 | Check whether the code parses at a specific language level. Newer syntax may be rejected by older targets. |
How to use the JavaScript Validator
Get a local syntax check without running untrusted code.
Paste or open code
Type JavaScript or open a local .js, .mjs or .cjs file up to 2 MiB.
Choose syntax mode
Leave Auto-detect on, or select Script or Module and the ECMAScript version.
Review the result
Jump to the reported position, read the code frame and use the hint as a starting point.
Useful feedback without running your code
A parser check with clear limits and no surprise uploads.
Exact location
See the line and column, the surrounding code and a pointer to the parser's stopping point.
Careful hints
Common causes are explained only when the error gives a reasonable clue; no automatic code edits.
Mode detection
Recognizes code that parses as a Script or an ES Module and tells you which one worked.
Version check
Check modern code against an older ECMAScript target before using it in a project.
Responsive
Parsing runs in a time-limited background worker so a large file cannot lock up the page.
Private by design
Your source stays in this browser tab. The tool parses it but never executes or uploads it.
Frequently asked questions
No. It parses the source text to check syntax. It never evaluates or executes your code, and it does not send the code to a server.
No. It means the parser accepts the syntax for the selected mode and ECMAScript version. Runtime errors, wrong results, security issues and style problems need other checks.
Modules support top-level import and export statements and have slightly different rules. If your file uses them, choose Module or leave Auto-detect on.
Not with this validator. It checks standard JavaScript syntax. TypeScript types and JSX need their own parsers.
No. Validation runs in a local browser worker. The page does not upload or save your source.
The maximum is 2 MiB. Auto-check pauses on larger input so you can decide when to run the check. The background worker has a time limit and is stopped if parsing takes too long.