Copying code and plagiarism

Question
Can copying code from GitHub, Stack Overflow or open-source software amount to plagiarism?

Short answer

Yes, copying code from GitHub, Stack Overflow or open-source projects can amount to plagiarism, but it does not always. Whether it does depends on the rules of the institution or context you are working in, whether you have properly acknowledged the source, and whether you have passed off someone else’s work as your own. Plagiarism is fundamentally about attribution and honesty, and it is a separate issue from copyright and licence compliance, which is about legal rights to use the code. It is entirely possible to breach one without the other, and quite common to breach both at the same time.

What plagiarism actually means

Plagiarism is presenting someone else’s work, ideas or expression as if they were your own, without proper acknowledgement. In an academic or assessment setting this is a form of academic misconduct, governed by the rules of the university, college, awarding body or professional body concerned rather than by a single statute.

The key point for code is that most institutions treat unacknowledged reuse of code exactly as they treat unacknowledged reuse of text. Computing departments routinely define plagiarism to include the inclusion in coursework of unacknowledged code taken from another student or from online sources such as GitHub or Stack Overflow. So the act of copying is not automatically misconduct; copying without disclosing the source, in a context where you are being assessed on your own work, is what crosses the line.

When copying code is plagiarism

It is likely to be plagiarism where all or most of the following are present. You are being assessed and the assessment is meant to reflect your own ability. You have taken code you did not write. You have not attributed it to its source. And you have presented it, expressly or by implication, as your own work. In that situation the fact that the code came from a public, free or “open” source makes no difference. Open source does not mean it is your source. The material still has an author, and failing to acknowledge that author while claiming credit is the core of plagiarism.

It can also be plagiarism even where you slightly modify or paraphrase the code. Renaming variables, reformatting, or restructuring copied logic does not convert someone else’s work into your own if the underlying expression and design are lifted. Many academic definitions expressly capture adapted or modified source code.

When copying code is not plagiarism

Copying is generally not plagiarism where you properly acknowledge the source and where the rules of the task permit reuse. Typical safe practice in an academic setting includes citing the origin of the code in both your report and in comments in the source files, giving as much detail as you can, such as author name, title of the code or library, version, date, type, the web address and the date you accessed it, and clearly marking where the reused block begins and ends. If you have modified reused code, you should say so.

It is also not plagiarism where reuse is expressly allowed and expected, for example where a module leader tells you to build on a provided library, or where using and referencing a named open-source component is part of the exercise. The controlling factor is what the assessment rules and the module instructions say. Standard practice among professional developers, where copying a Stack Overflow snippet with no comment is normal, is not the standard applied to assessed academic work, so you should not assume workplace norms transfer to coursework.

Plagiarism is not the same as copyright or licence breach

This distinction matters and is often confused. Plagiarism is about honesty and attribution and is enforced by institutions and professions. Copyright is a legal right, protected in England and Wales under the Copyright, Designs and Patents Act 1988, and it protects the code as a literary work regardless of whether you credit the author.

You can plagiarise code that you are legally entitled to copy. Public-domain or permissively licensed code can lawfully be reused, but if you pass it off as your own in an assessment you have still committed plagiarism. Equally, you can infringe copyright even when you do credit the author, if you copy in a way the licence does not permit.

Open-source licences almost always impose conditions. Permissive licences such as MIT or Apache typically require you to preserve the copyright notice and licence text. Copyleft licences such as the GPL can require that your whole derived work be released under the same terms. Stack Overflow content is generally licensed under Creative Commons Attribution-ShareAlike, which requires attribution and share-alike treatment, and research suggests the overwhelming majority of real-world reuse of Stack Overflow snippets does not actually comply with those conditions. Even where a licence permits modification, authors usually retain their moral right to be identified as authors, so attribution obligations can persist independently of what the permissive terms allow.

Why the innocent explanation still may not save you

Students often reason that free and public code cannot belong to anyone and so cannot be plagiarised. That reasoning fails on both fronts. “Freely available” addresses access, not authorship or ownership. Something being downloadable at no cost says nothing about whether you may present it as your own or whether the licence conditions have been met. Genuine accidental overlap or independently writing similar short, standard code can be a real and legitimate explanation in a borderline case, but wholesale copying of distinctive blocks is not readily explained that way.

Consequences to be aware of

In an academic context, findings of plagiarism can lead to penalties ranging from a capped or zero mark for the assessment, to failing the module, to more serious sanctions including withdrawal from a course, depending on the institution’s regulations and the seriousness of the case. Detection tools designed for source code, which compare structure rather than just text, are widely used, so superficial changes rarely defeat them. Separately, a licence or copyright breach is a legal matter that can arise regardless of the academic outcome.

Practical steps to stay safe

1. Check the specific rules for your assessment and module before reusing anything, because permission and referencing requirements vary between institutions and even between modules.

2. Keep a record as you work of every external source you draw on, including the URL, author, version and date accessed, so you can attribute accurately later.

3. Attribute reused code clearly in both your report and inline comments, marking exactly which sections are reused and whether you modified them.

4. Preserve any existing author and licence notices in the code, and check that the licence actually permits the use you intend, especially for copyleft licences that may affect your whole submission.

5. If in doubt about whether reuse is allowed or how much you may use, ask the module leader or supervisor in advance and keep their answer, rather than relying on general developer norms.

Key missing facts

The precise answer turns on your context, which you have not specified. If this concerns a university or college assessment, the decisive document is that institution’s academic misconduct and referencing policy and the specific brief for the assessment. If it concerns commercial or professional software development rather than assessed work, the plagiarism concept is weaker or absent and the real risk is copyright and licence compliance. If you can tell me which setting applies and, for an academic matter, which institution and what the brief says about permitted reuse, I can give you a more precise answer.

Current sources checked

This answer draws on broad legal knowledge and checks current law, guidance and procedure against relevant sources.

Good Academic Practice | CS Student Handbookinfo.cs.st-andrews.ac.ukSoftware - Copyright - Library guides at City St George's, University of Londonlibguides.citystgeorges.ac.ukUsage and Attribution of Stack Overflow Code Snippets in GitHub Projectsassets.empirical-software.engineeringStudent perspectives on source-code plagiarismdcs.warwick.ac.uk
Verify important information before relying on it.
Was this helpful?
0 people found this helpful

Ready to stop guessing?

The above is just an example answer. Sign up now to get personalised guidance and ask follow-up questions based on your own situation. Bring your legal issue, your contract, or your question. Lawyer Destroyer gives you clear, practical guidance so you can move forward with confidence.