Find dead code

Flag JavaScript declarations that appear to have no later textual reference.

freeworks offlinenothing uploaded
ToolDead Code Finder
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Comments and strings are masked, declarations and function names are collected with regular expressions, and remaining textual references are counted. Findings are potential unused code; dynamic property access and module graphs are not resolved.

  • The heuristic is fast for small snippets.
  • It reports candidates rather than proving unreachable execution.

Worked example

Find unused declarations
Detect unused variables and functions in JavaScript
Input
											const API_URL = '/api';
const unused = 42;
function helper() { return API_URL; }
function orphan() { return 1; }
helper();
										
Output
												Dead Code Analysis (Simple Static Check)
=========================================

Potentially unused variables (1):
  - unused (line 2)

Potentially unused functions (1):
  - orphan (line 4)

Note: This is a basic static analysis. Dynamic usage,
exports, and indirect references may not be detected.
											

When to use this

Refactor reviews, teaching exercises, and generated-script cleanup use candidate findings.

Edge cases

  • Reflection or string calls can make a used function look unused.
  • An exported symbol used by another module is invisible without imports.
  • Nested scopes can confuse repeated names.