Cyclomatic Complexity Calculator for Python

Calculate cyclomatic complexity for Python functions and methods, the same way radon and mccabe do. Free and private: runs in your browser.

Paste Python code to score each def, including methods inside classes. if, elif, for, while, except, and, or and comprehension conditions are all counted.

Runs entirely in your browser. Nothing you paste is uploaded or stored.

Use cases

  • Check a function before opening a pull request.
  • Explain a review comment with numbers instead of opinions.
  • Find the riskiest code to refactor first.

Frequently asked questions

How does this compare to radon or flake8-mccabe?

It follows the same McCabe rules, so scores are usually identical or within one point. Use radon in CI for the whole project and this page for quick checks.

Is the Cyclomatic Complexity Calculator for Python free?

Yes. It is free with no sign-up, and it runs entirely in your browser, so your input is never uploaded or stored.

How accurate is a browser-based code check?

It uses fast heuristics on the snippet you paste, so it is great for quick feedback. For whole repositories, cross-file analysis and history, run a full CodeInspector scan.

Related tools

Track complexity, duplication and code smells across your whole codebase with CodeInspector.

All free developer tools