The classic definition of plagiarism is presenting someone else's work as your own without credit. AI code fits awkwardly: there may be no "someone else" whose program you copied, and the code might be new. So is it plagiarism? For a student, the practical answer is that it does not matter much which word is used. Many universities and courses already treat undisclosed or unauthorized AI-written code as an academic integrity violation, whether they call it plagiarism, unauthorized assistance or unauthorized collaboration. This page explains how those policies frame it, the narrower case where AI output really can match someone else's code, and how plagiarism differs from copyright. The policies and documents below are ones we read in October 2026.
How integrity policies frame AI-written code
Policies tend to use one of three framings. Which one your course uses changes the details, but not the basic rule.
- AI as another person. Stanford's generative AI policy guidance says that, unless a course says otherwise, using or consulting generative AI is treated like assistance from another person, and using it to substantially complete an assignment or exam is not allowed. Under that framing, submitting AI-written code is handled like submitting code a friend wrote for you.
- AI as unauthorized collaboration. The integrity page for a Swarthmore College computer science course (last updated September 2025) says that using generative AI such as ChatGPT or GitHub Copilot is considered unauthorized collaboration, and that the policy applies to all course work, including code.
- AI as an outside source the course limits. Harvard's CS50x academic honesty page lists AI software other than CS50's own that suggests or completes answers or lines of code as not reasonable, and separately lists submitting another person's work, modified or not, and using code or techniques from outside the course without citing them. It also says the essence of all work you submit must be your own.
The common thread is authorship. A course grades your work because it wants to know what you can do. Code you did not write, submitted as if you did, defeats that purpose whether it came from a classmate, a website or a model.
When AI code is not an integrity problem
AI-written code is not automatically wrong. If your course allows a particular tool for a particular purpose, and you use it that way and disclose it as required, you are following the rules. The issue is not the tool; it is using it where it is not allowed, or hiding that you used it. If you are unsure which applies, our guide to whether using ChatGPT for coding homework is cheating goes through how to read a policy and what to ask.
Does modifying the code change anything?
Often students ask whether renaming variables or reorganizing AI output makes it their own. Under policies like the ones above, no. CS50x, for instance, treats submitting another person's work as not reasonable whether or not it was modified. The question an integrity policy asks is where the substance of the solution came from, not how many characters you changed. Editing is not a substitute for permission and disclosure.
Can AI output copy real people's code?
There is also a more literal version of the plagiarism question. AI assistants learn from large amounts of existing code, and sometimes a suggestion matches code that already exists. GitHub's code referencing documentation says Copilot checks suggestions for matches with code in public repositories on GitHub.com and, depending on settings, can block matches or show information about the matching code, including detected licenses. The same page says matches are uncommon and that code outside public GitHub repositories is not included in that search.
For a student, the takeaway is simple: if you use AI where it is allowed, you are still responsible for what you submit, including where it came from. If a tool tells you a suggestion matches public code, treat that code like any other outside source and follow your course's citation rules, or do not use it.
Plagiarism is not the same as copyright
People sometimes mix up plagiarism and copyright. They are different questions:
- Plagiarism and academic integrity are about honesty in your course: did you present work as your own when it was not, and did you follow the rules on help and citation?
- Copyright is a legal question about who owns a work and what others may do with it.
On the copyright side, the US Copyright Office's January 2025 announcement of its report on copyrightability says that AI outputs can be protected only where a human author has contributed enough expressive elements, and that merely providing prompts is not enough. That conclusion is about US copyright law. It does not decide whether your course allows AI, and owning or not owning code says nothing about whether submitting it was honest. For a homework assignment, the integrity question is the one that matters.
How to cite AI help when it is allowed
If your course permits AI use and asks you to credit it, keep it short and specific:
- Where: in your README or submission notes, plus a brief comment next to any code that was substantially shaped by the tool.
- What: the tool, what you used it for, and what you wrote or changed yourself.
- Format: your course's required format if it has one; ask if it does not.
Remember that citing makes allowed use transparent. It does not turn a prohibited use into an allowed one.
Checking your own code
Similarity tools such as MOSS compare submissions with each other rather than looking for AI, as explained in does MOSS detect AI code. To see how your own code reads, paste it into the detector at the top of this page and look at the reasons it gives. If it points at a section you cannot explain, that is worth revisiting before you submit, whatever your course allows.
Read more
- How to use ChatGPT for coding homework without cheating — a routine for courses that allow AI help.
- How to prove you wrote your own code — keeping a record of your process.
Frequently asked questions
Is AI-generated code plagiarism if nobody else wrote it?
Under many academic policies, submitting it as your own work without permission is treated as an integrity violation, whatever label is used. Stanford's default guidance treats AI help like help from another person, and a Swarthmore computer science course page calls it unauthorized collaboration. Your course policy decides which rule applies.
Is it plagiarism if my course allows AI and I disclose it?
Generally no. Using a tool the course permits, in the way it permits, and saying so openly is following the rules. Problems come from undisclosed use or use the course does not allow.
Can AI-generated code copy someone else's code?
It can sometimes match existing public code. GitHub's documentation says Copilot checks suggestions for matches with code in public GitHub repositories and can show the matching files and detected licenses, while noting that matches are uncommon. That is a separate issue from authorship, but another reason to understand and check everything you use.
How do I cite AI-generated code?
Use your course's format if it has one. Otherwise, a comment near the code and a note in your README saying which tool you used, for what, and what you changed is clear. Citing does not make a prohibited use allowed, so check the policy first.
Is plagiarism the same as copyright infringement?
No. Plagiarism is an academic question about presenting work as your own without credit. Copyright is a legal question about who owns a work. The US Copyright Office has said, for example, that prompts alone do not make someone the author of AI output, but that is about legal protection, not about whether your course allows it.
Try the detector
Have a snippet you are unsure about? Paste it into the free AI Code Detector to get a verdict, an AI probability and the reasons behind it. No sign-up, and your code is not stored.