AST Explorer
v1.0AST Explorer parses JavaScript or JSON in your browser and shows the syntax tree it produces.
Type or paste code, or load a sample from the Sample menu (a recursive function, a class with private fields, a module with imports and exports, modern syntax like optional chaining, or a JSON config). Clear empties the editor.
Each node in the collapsible tree shows its type, its key or index within its parent, and its character range. Click a node and its source is selected in the editor. Click or move the cursor in the source and the matching node is selected and revealed in the tree. The tree works from the keyboard too. A detail panel lists the selected node's location and values, with a button to copy the node's source. Search matches node types and source text, expands the tree to every match, and steps through them with Enter or the arrow buttons.
Valid code parses as you type. A syntax error waits until you stop typing, then says what is wrong, at which line and column, and marks the spot in the editor. Meanwhile the tree keeps the last version that parsed, dimmed.
JSON is checked strictly, so unquoted keys, trailing commas, comments, undefined and other JavaScript-only syntax are reported at the token that breaks the rule. For JavaScript, Module and Script set how top-level import, export and other mode-dependent syntax is read. If the chosen mode can't parse the code but the other can, the tool switches, says so, and offers to make that mode the default.
Your source, language and mode are remembered on this device. Share links carry them, unless the source is too large for a link. Nothing is uploaded.