AnyTool
Your files never leave your device. All processing happens locally in your browser.

How to measure code complexity online without uploading my source?

Paste or drop JS, TS, JSX or TSX into AnyTool's Code Complexity Analyzer. It parses your code with the real TypeScript compiler in your browser and reports cyclomatic, cognitive, Halstead and a maintainability grade per function. Your code never leaves your device - no upload, no signup.

  • AST-accurate McCabe cyclomatic and cognitive complexity, not regex guessing
  • Halstead suite plus a 0-100 maintainability index with A-F grade per function
  • Sortable per-function risk table, editor heat-map and live what-if thresholds
  • 100% in your browser - no upload, no signup, works offline

What is

Code Complexity Analysis

Code complexity analysis measures how hard source code is to understand and maintain using metrics like cyclomatic complexity, cognitive complexity, Halstead volume and a maintainability index.

Developer Tools

Related terms

Cyclomatic ComplexityCognitive ComplexityMaintainability IndexHalstead Metrics

Frequently Asked Questions

Yes. Code is parsed entirely in your browser and never uploaded to any server.

Yes. AnyTool parses your source with the bundled TypeScript compiler inside a Web Worker on your own device. Nothing is sent to a server or CDN, so it works offline and your code stays private.

Cyclomatic, cognitive, Halstead, maintainability grade, nesting, params and line metrics per function.

It computes McCabe cyclomatic complexity, nesting-weighted cognitive complexity, the full Halstead suite (volume, difficulty, effort, estimated bugs), a 0-100 maintainability index with an A-F grade, plus max nesting, parameter count and LOC/SLOC, both per function and per file.

JavaScript, TypeScript, JSX and TSX, parsed with the real TypeScript AST.

It is AST-accurate for JavaScript, TypeScript, JSX and TSX because it uses the actual TypeScript compiler. It does not analyze Python, Java, Go or other languages, and it is a snapshot tool, not whole-repo trend tracking.

Open a folder or select multiple files to get a project aggregate view.

Use Open folder or Open files to load up to 60 JS/TS files at once. Each file is graded, and you get a project aggregate with average and max cyclomatic complexity, total SLOC and high-risk function counts, all client-side.

Detailed Explanation

Technical Details

Code Complexity Metrics Computed by AnyTool

AnyTool's Code Complexity Analyzer parses JavaScript, TypeScript, JSX and TSX with the real TypeScript compiler (ts.createSourceFile) rather than regex, so metrics reflect the actual syntax tree. Cyclomatic complexity counts every if, for, while, do, case, catch, ternary and logical operator (&&, ||, ??), while cognitive complexity adds nesting penalties per the SonarSource model. It also derives the full Halstead suite and a 0-100 maintainability index with an A-F grade.

  • Uses the bundled TypeScript compiler AST, not keyword counting
  • Reports cyclomatic, cognitive, Halstead and maintainability index
  • Maintainability index uses 171 - 5.2*ln(HV) - 0.23*CC - 16.2*ln(SLOC), normalized to 0-100
  • Metrics are computed per function and aggregated per file
Use Cases

Per-Function Risk Table and Live Thresholds

Results appear in a sortable per-function table showing start line, cyclomatic, cognitive, nesting, params, SLOC and maintainability grade, color-coded by risk. Adjustable what-if threshold sliders re-classify functions and re-tint the editor heat-map instantly without reparsing the code. Clicking a row jumps to that function in the editor, and folder uploads of up to 60 files produce a project aggregate with average and max complexity.

  • Sortable risk table with click-to-jump to the function line
  • Editor gutter heat-map tints lines by enclosing-function complexity
  • Threshold sliders re-classify risk with no reparse
  • Multi-file mode analyzes up to 60 files for a project aggregate
Privacy & Security

Privacy Model and Honest Limits

All parsing runs in the browser inside a Web Worker, so source code is never uploaded to a server or CDN and the tool works offline. It is AST-accurate only for JS/TS/JSX/TSX and does not analyze Python, Java, Go or other languages. It analyzes the snapshot of code you paste or upload and does not track repository trends over time the way cloud SaaS tools do.

  • Code never leaves the device - no upload, no server, no CDN
  • AST-accurate for JS, TS, JSX and TSX only
  • Snapshot analysis, not whole-repo historical trend tracking
  • Cannot fetch source by URL because browsers block cross-origin source fetch
AnyTool Code Complexity Analyzer vs typical online alternatives
CapabilityAnyToolTypical alternative
Privacy / no uploadYes - 100% client-sideOften server-side or AI-based
Parsing accuracyReal TypeScript ASTOften regex or decision-point scan
Cognitive complexityFree, no loginHidden behind paid tier (e.g. Sonar Cloud)
Halstead + maintainability gradeYes, on one screenUsually partial or missing
Price / signupFree, no signupFreemium, paywall or GitHub auth

AST-accurate for JS/TS/JSX/TSX; not a multi-language or whole-repo trend tracker.