Introduction
Welcome to jscpd, a powerful copy/paste detector for programming source code that supports 224 languages and formats.
What is jscpd?
jscpd is a tool that helps you find duplicated blocks in programming source code. Copy/paste is a common source of technical debt in software projects, and jscpd helps you identify and eliminate these duplications.
jscpd reads code the way its language defines it, not as plain text. Each of the 224 formats is tokenized with its own comment and string syntax, JavaScript and TypeScript go through the oxc parser, and Vue, Svelte, Astro, Markdown and Razor files are split into their embedded languages first. Identifiers, keywords and literals are classified, which is what lets the renamed-clone options replace names while keeping keywords in place.
On that token stream the tool uses the Rabin-Karp rolling hash algorithm for efficient searching of duplications across large codebases. The engine is implemented in Rust and ships as a self-contained binary. See How Detection Works for the full pipeline.
jscpd v5
jscpd v5 is a complete Rust rewrite — a self-contained native binary with no Node.js runtime required. It ships 15 reporters, OXC-based JS/TS tokenization, parallel detection across format groups, and a built-in MCP server (cpd --mcp).
See the Changelog for the full release history. Coming from the TypeScript version? See the Migration Guide — v4 itself is described on the v4 page and lives on the master-v4 branch.
Key Features
224 Languages
Language-Aware
Blazingly Fast
CLI-First + Rust API
cpd-finder, cpd-core) for programmatic use.15 Reporters
AI-Ready
ai reporter saves ~79% tokens. MCP server for AI assistants. Agent skill for automatic refactoring.Cross-Format Detection
<script> in .vue matches .ts files.Packages
| Package | Description |
|---|---|
| jscpd | Main binary — npm install -g jscpd or cargo install jscpd |
| cpd | Lightweight alias — same binary, shorter command |
| cpd-core | Rust crate — core detection algorithm |
| cpd-tokenizer | Rust crate — source code tokenizer |
| cpd-finder | Rust crate — file walking, orchestration, git blame |
| cpd-reporter | Rust crate — output reporters |
Quick Example
# Install the native binary via npm
npm install -g jscpd
# Or via cargo
cargo install jscpd
# Scan a directory
jscpd /path/to/source
Ready to get started? Head to the Installation guide, or the Migration Guide if you're upgrading from v4.