Cyclomatic Complexity Calculator for Java
Measure the cyclomatic complexity of Java methods online, with a rating per method. Free and private: runs in your browser.
Paste a Java class or method. Every if, for, while, case, catch, &&, || and ternary adds a decision point, and each method gets a McCabe score.
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
Does it count switch cases and lambdas?
Each case label adds one. Boolean operators (&& and ||) add one each, as do ternaries and catch blocks. Lambda bodies are counted inside the method that declares them.
Is the Cyclomatic Complexity Calculator for Java 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.