New Breakthrough AI Detection. Our best yet for AI-written source code. Catches 90% of AI/GPT code with 1.3% false flags. 90% caught, 1.3% false flags. Read more Read more
New: MCP integration. Run plagiarism scans from Claude, Cursor or any AI assistant. Run scans from Claude or Cursor. Set it up

How to detect code plagiarism

Detecting code plagiarism takes three things: a structural comparison of the class, a look outside it at the web, past terms and AI, and a careful read of the matches before anyone is accused. This guide walks through each one.

2-day free trial. Checks every file against classmates, the web and AI, in 65+ languages.

90%
Renamed, recommented, same program Every name and the comment changed. The structure did not.
Example
Submission Apalindrome.js
1function isPal(s) {2 const t = s.toLowerCase()3 .replace(/[^a-z0-9]/g, "");4 let i = 0, j = t.length - 1;5 while (i < j)6 if (t[i++] !== t[j--])7 return false;8 return true;9}
Submission Bcheck.js
1// same forwards and backwards2function checkText(str) {3 const clean = str.toLowerCase()4 .replace(/[^a-z0-9]/g, "");5 let a = 0, b = clean.length - 1;6 while (a < b)7 if (clean[a++] !== clean[b--])8 return false;9 return true;10}
Classmates: 1 matchWeb sources: no matchAI detection: not flagged

The most common disguise: new names and a new comment (highlighted). To a structural comparison, the two are the same program.

Signs you can spot by hand

Before any tool, experienced graders notice patterns. None of these proves anything alone, but each is a reason to look closer:

  • The same mistake. Two submissions with the same bug, the same off-by-one or the same wrong edge case. Honest students rarely share an error.
  • Odd details that match. The same unusual variable name, the same dead code, the same leftover debug print, the same strange spacing.
  • Code above the course. Features, libraries or idioms the course has not covered, used fluently.
  • A change of voice. Parts of one file written in clearly different styles, or work that does not match the student's earlier submissions.
  • Comments that explain the obvious, or describe code that is not there. Both are common in copied and AI-written work.

By hand, this works for a handful of submissions. Past that, you need a tool to decide which pairs to read.

Step by step

Step 1Set the rules before the assignment

Say what collaboration is allowed, whether AI tools are, and how sources should be credited. Put it in the assignment itself. Everything after this step is easier to defend when the rule was written down.

Step 2Compare the class by structure

Run every submission against every other with a structural tool. These tokenize the code, so names, comments and formatting drop out, and then compare what is left. Leave out the starter code you handed out, or every submission will match it.

Step 3Look outside the class

Most copied code today comes from outside the class: GitHub, Stack Overflow, tutorial sites, and last year's students. A peer-only comparison cannot see any of it. Check the submissions against web sources and against earlier terms of the course.

Step 4Check for AI-written code

Code from ChatGPT, Claude, Gemini or Copilot is often unique to each student, so it matches nothing. An AI code detector looks at how the code is written instead. Treat its result as a question to ask, not an answer.

Step 5Read the matches, not the scores

Sort by score and open the top pairs. For each one, discount starter code, short programs and textbook algorithms, then look for what is hard to share by accident: the same bug, the same odd structure, the same dead code.

Step 6Talk to the student and write it down

Ask the student to walk you through their code and change a part of it. Someone who wrote it can. Keep the matched lines, the source and your notes together, in case the case goes further.

Steps 2 to 5 in one check

Classmates, past terms, the web and AI, with the matched lines side by side.

Start free trial

2-day free trial

Common disguises

Students who copy usually change something. Here is what the common changes do against a structural comparison:

ChangeHides the copy?
Renaming variables and functionsNo, names are ignored
Rewriting comments, reformattingNo, both are ignored
Reordering independent lines or functionsRarely, most of the structure survives
Adding unused codeLowers the score, the matched part still shows
Translating to another languageSometimes, depending on the tool
Asking an AI to rewrite itOften, which is why AI detection is its own step

What MOSS misses shows real refactored copies next to the scores they got.

Tools for each step

MOSS, JPlag, DolosCodequiry
Compare the class by structureYesYes
Leave out starter codeYesYes
Check the webNoYes
Check past termsOnly if you add them by handYes
Detect AI-written codeNoYes
CostFreePlans, free trial

The free tools compared in detail: MOSS vs Dolos vs JPlag. For what a full check looks like, see the code plagiarism checker, and for the concepts behind all of this, what code plagiarism is.

Frequently asked questions

How do teachers detect code plagiarism?

They compare every submission in the class by structure with a tool like MOSS, JPlag or Codequiry, check the work against the web, past terms and AI, and then read the flagged pairs line by line before talking to the student.

Can you detect plagiarism if the variable names are changed?

Yes. Structural comparison ignores names, comments and whitespace, so a renamed copy matches almost as strongly as an exact one.

Can plagiarism be detected across programming languages?

Often, yes. A solution translated from Python to Java keeps the same structure, and tools that compare structure rather than text can match it.

How do you prove a student copied code?

You do not prove it with a score. You show the matched lines, the source, and anything hard to share by accident, such as the same bug or dead code, and you ask the student to explain their work. Their explanation usually settles it.

What similarity percentage is too high?

There is no fixed cut-off. Short programs and starter code can score high between honest students, and a disguised copy can score lower. Use the score to decide what to read, not what to conclude.

Can you detect code written by ChatGPT?

An AI code detector can flag code that is likely AI-written and say why. It is a signal to follow up on, especially when a submission does not match the student's earlier work, not proof on its own.

Is there a free way to detect code plagiarism?

Yes. MOSS is free for academic use, JPlag and Dolos are open source, and Codequiry's free check compares up to 20 submissions with each other with no account. None of these search the web or detect AI.

Run the check on a real assignment

Upload a class's submissions and see which match classmates, past terms, the web or AI.

Start free trial

2-day free trial

Just one assignment? Run a single check

Tools and sources referenced on this page

Codequiry is compared with these tools above. Each link goes to the project's official site so you can check the claims yourself.

  • MOSS (Measure of Software Similarity) Stanford University, Alex Aiken

    Free academic similarity service from 1994 that fingerprints code with winnowing and reports matching passages between submissions.

  • JPlag Karlsruhe Institute of Technology, open source

    Open-source token-based detector that compares programs with Greedy String Tiling and produces a similarity report per pair.

  • Dolos Ghent University, open source

    Open-source similarity tool built on tree-sitter parsing, with a web interface for exploring clusters of related submissions.

Topic index

Explore Codequiry's code plagiarism detection toolkit

Dig deeper into the most accurate source-code plagiarism checker on the market, every language, every detection engine, every academic-integrity use case.