jscpd
Copy/paste detector for 224 source formats with a Rust engine. Also reports dead code, complexity, git-history duplication trends, and a health score.
jscpd is a duplicate code detector written in Rust and shipped as a self-contained binary. It tokenizes each of its 224 supported formats using that language's own comment and string rules, then finds repeated token sequences across files with a rolling Rabin-Karp hash. JavaScript, TypeScript, JSX and TSX are parsed with the oxc parser, and embedded languages are extracted from Vue, Svelte, Astro, Markdown and Razor files. Run it with jscpd /path/to/code.
By default it reports exact clones. Opt-in flags extend detection: --ignore-identifiers, --ignore-literals and --ignore-annotations find Type-2 clones that differ only in names or values. --max-gap-lines N and --similarity 0.85 find Type-3 near-miss clones. The experimental --semantic flag uses a code embedding model to find functions that do the same thing written differently (Type-4). --compare dirA/ dirB/ pairs functions across two codebases to show what has no counterpart in the other. Results can be filtered by kind with --kind, and --skip-local and --skip-isolated limit reports to cross-folder or cross-team duplication in monorepos.
Beyond duplication, it has --dead-code (unused files, exports, declarations and imports in JavaScript, TypeScript and Python), --complexity and --summary for ranking files and folders, --history for duplication trends across a git commit range, --blame for author comparison, --dashboard, and --health for a single 0-100 score. There are 15 reporters, including console, json, xml, csv, html, markdown, badge, sarif, codeclimate, openmetrics and an ai reporter. A baseline mode (--baseline, --fail-on-new-clones) fails CI only on newly introduced clones.
Integrations include a GitHub Action that uploads SARIF to Code Scanning, GitLab-compatible report artifacts, pre-commit hooks, an LSP server (jscpd --lsp) for Neovim, Helix, Sublime Text, Emacs and JetBrains IDEs, and an MCP server and agent skills for AI agents. It targets developers and teams who want to gate CI on duplication or track code quality over time. It installs through npm, PyPI, Cargo, Homebrew, Nix and Docker.
Installation
# via Homebrew
brew install jscpd
# via npm
npm install -g jscpd
# via Cargo
cargo install jscpd
Alternatives & related tools
pastel
Command-line tool to generate, analyze, convert and manipulate colors across multiple formats and color spaces
tealdeer
Fast Rust implementation of tldr providing simplified, example-based manual pages for command-line tools
zizmor
Static analysis tool that finds and fixes security issues in CI/CD configurations, including GitHub Actions workflows, Dependabot, and pre-commit.
watchexec
File watcher that runs commands when files change, with .gitignore support and cross-platform filesystem monitoring
sd
Find and replace CLI tool with regex support, string-literal mode, and faster performance than sed
add a badge to your README
Maintain jscpd? Show that it's featured on trmn. The badge links back to this page.
[](https://www.trmn.sh/tools/jscpd?utm_source=badge)<a href="https://www.trmn.sh/tools/jscpd?utm_source=badge"><img src="https://www.trmn.sh/badge/jscpd.svg" alt="Featured on trmn" height="20"></a>