Getting Started

Introduction

Welcome to jscpd documentation.

Welcome to jscpd, a powerful copy/paste detector for programming source code that supports 223+ languages and formats.

Two Versions

jscpd is available in two major versions:

v5 (Rust)v4 (TypeScript)
Installnpm install -g jscpd@5npm install -g jscpd@4
Speed24-37x fasterBaseline
RuntimeSelf-contained binary (no Node.js)Requires Node.js
APIRust crates (cpd-finder, cpd-core)Node.js (import { jscpd } from 'jscpd')
SupportActive developmentMaintenance

Use v5 for the fastest detection. Use v4 if you need the Node.js programmatic API. Both can coexist — see the Migration Guide.

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.

The tool uses the Rabin-Karp rolling hash algorithm for efficient searching of duplications across large codebases. In v5, the engine is implemented in Rust; in v4, it runs on Node.js.

What's New in v5

jscpd v5 is a complete Rust rewrite — a self-contained native binary that's 24-37x faster than the TypeScript engine, with no Node.js runtime required. It also introduces 13 reporters, OXC-based JS/TS tokenization, and parallel detection across format groups.

See the Changelog for the full release history, or the Migration Guide for upgrading from v4.

Key Features

223+ Languages

Supports JavaScript, TypeScript, Python, Java, C++, Go, Rust, and many more — including cross-format detection for Vue, Svelte, Astro, and Markdown.

Blazingly Fast (v5)

v5's Rust engine is 24-37x faster than v4. Scans massive codebases in milliseconds, not seconds.

CLI-First + Rust API

v5: single native binary with Rust crate API. v4: Node.js API for programmatic use. Same CLI commands in both.

13 Reporters

Generate reports in console, console-full, HTML, JSON, XML, CSV, Markdown, SARIF, AI, badge, xcode, threshold, and silent formats.

AI-Ready

Compact ai reporter saves ~79% tokens. MCP server for AI assistants. Agent skill for automatic refactoring.

Cross-Format Detection

Vue SFC, Svelte, Astro, and Markdown files are tokenized per-block — a <script> in .vue matches .ts files.

Packages

v5 (Rust)

PackageDescription
jscpdMain binary — npm install -g jscpd@5 or cargo install jscpd
cpdLightweight alias — same binary, shorter command
jscpd-serverStandalone server (REST API + MCP) — still Node.js based
cpd-coreRust crate — core detection algorithm
cpd-tokenizerRust crate — source code tokenizer
cpd-finderRust crate — file walking, orchestration, git blame
cpd-reporterRust crate — 13 output reporters

v4 (TypeScript) — Maintenance

PackageDescription
jscpd@4CLI + Node.js API (import { jscpd } from 'jscpd')
jscpd-serverStandalone server (REST API + MCP)
@jscpd/coreCore detection algorithm
@jscpd/finderFile duplication detector
@jscpd/tokenizerSource code tokenizer
@jscpd/html-reporterHTML report generator
@jscpd/badge-reporterBadge generator
@jscpd/sarif-reporterSARIF reporter
@jscpd/leveldb-storeLevelDB store for big codebases

Quick Example

# v5 — install Rust binary (recommended)
npm install -g jscpd@5

# v5 — or via cargo
cargo install jscpd

# v4 — install TypeScript version
npm install -g jscpd@4

# Both versions use the same CLI
jscpd /path/to/source

Ready to get started? Head to the Installation guide or the Migration Guide if you're upgrading from v4.