Duplicate Code Block Finder
Finds blocks of code repeated in a file, ignoring comments and indentation.
Loading the tool…
Processing happens locally in your browser.
What you paste or load is processed by this page and is not uploaded to a server. Nothing is stored unless you use a control that says it stores something, and you can clear anything this site has kept from the privacy page.
How to use this tool
- Paste the file you suspect has repetition in it.
- Set the smallest block worth reporting; four lines is a reasonable starting point.
- Select Find duplicates.
- Judge each finding — repeated boilerplate is often fine, repeated logic rarely is.
What duplicate block finder does
Copy-and-paste is how a bug gets fixed in one place and left in three others. This looks for runs of code that appear more than once and reports where each copy starts, so you can see whether the repetition is worth extracting or is genuinely coincidental — four lines of boilerplate assignment often are.
Comments and blank lines are dropped before anything is compared, and whitespace differences are ignored by default, so two blocks that were reformatted or re-commented separately still match. Overlapping windows of one long clone are reported once rather than as a finding per line, which is what makes the output readable.
Frequently asked questions
Not by default. Comments and blank lines are dropped before anything is compared and whitespace differences are ignored, so two copies that were reformatted or re-commented separately still match. Switch whitespace to respect if you want an exact comparison.
No, and the tool deliberately does not say it is. Repeated boilerplate — a run of field assignments, a standard guard clause — is often clearer left alone. Repeated logic is the case worth extracting, because that is where a fix applied once and missed twice comes from.
Because reporting every overlapping window inside it would bury the result. Once a block is claimed by a finding, the lines inside it are not reported again, so a twenty-line clone appears once rather than seventeen times.