JavaScript

JavaScript Syntax Checker

Says whether a snippet parses, and shows the engine error if it does not.

Loading the tool…

Processing happens locally in your browser. What you paste or load is processed by this page and is not uploaded to a server. Nothing is stored unless you use a control that says it stores something, and you can clear anything this site has kept from the privacy page.

How to use this tool

  1. Paste the JavaScript, or load the file that will not load.
  2. Select Check the syntax. Nothing is executed — the snippet is compiled and thrown away.
  3. If it fails, look at the reported line and then at the few lines before it.
  4. 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.

Frequently asked questions

No. It is compiled and then discarded, and compiling does not run anything. That is what makes this page safe to point at code you have not read. If you do want to run something, the sandbox page is the one to use.

That is normal. A parser reports where it could no longer make sense of the input, which is usually a line or two after the actual mistake — a missing closing brace is only noticed when something that cannot follow it turns up. Look just above the reported line, and check the bracket counts in the result.

Only syntax. It answers the question "will this parse", using your browser's own parser, so the verdict matches what the browser will actually do. It is not a linter and it will not tell you that a variable is unused or that a comparison is always true.