JavaScript Syntax Checker
Says whether a snippet parses, and shows the engine error if it does not.
Loading the tool…
How to use this tool
- Paste the JavaScript, or load the file that will not load.
- Select Check the syntax. Nothing is executed — the snippet is compiled and thrown away.
- If it fails, look at the reported line and then at the few lines before it.
- Check the bracket counts in the result — an imbalance there is usually the whole story.
What javascript syntax checker does
When a file will not load and the console says nothing useful, the first question is simply whether it parses. This page answers that with the browser's own parser, so the verdict is the real one rather than an approximation from a third-party grammar — if your browser will run it, this says valid, and if it will not, you get the engine's exact message.
Nothing is executed. The snippet is compiled and then thrown away, and compiling does not run anything, which makes this page safe to use on code you have not read. Alongside the verdict you get a bracket count that ignores braces inside strings, template literals and comments — the usual reason a naive count disagrees with reality — and a tally of what is in the file. The reported line number is where the parser gave up; the actual mistake is very often just before it.