How To Cite Open Source Code

Before we discuss how to properly cite, let’s review when it’s appropriate to cite. As a rule of thumb, if the code contains common knowledge that any junior developer would know, then it’s not necessary to cite the reference code. That being said, if there is ever a doubt as to whether or not a citation is needed, add the citation. Your integrity as a programmer is priceless and you should place yourself in a position where you could be accused of plagiarism. Whether you are using a complete code block, or a section of code, you must cite where you found the information.

Open Source Software

Open-source software (OSS) is a software released under a license with a copyright holder. OSS is typically shared publicly and anyone can access, use and modify the source code.

Code from an Open Source Software is arguably the easiest to cite because they come with ready-to-use citations. OSS code comes with a distribution license, which includes the licensing terms and citations. It’s best to store the license in the file with the code.


GitHub makes citations easy by allowing the original creator(s) to add a CITATION.cff file. The CITATION.cff the file is a plain text file where the creator can specify how they would like to be credited and what to include in the citation. CITATION.cff files are currently supported by GitHub, Zenodo, and Zotero.

Below is an example CITATION.cff file from GitHub to use as reference:

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
- family-names: "Lisa"
given-names: "Mona"
orcid: ""
- family-names: "Bot"
given-names: "Hew"
orcid: ""
title: "My Research Software"
version: 2.0.4
doi: 10.5281/zenodo.1234
date-released: 2017-12-18
url: ""

Place the information contained in the CITATION.cff file on the page where the code is used.

Bonus: When a GitHub repository includes a CITATION.cff file following the example format, it will automatically both APA and BibTeX citations.

How To Cite Open Source Code Image
GitHub APA and BibTeX Citation Example

Stack Overflow

When you search for coding help on your favorite search engine (Google), your top results is likely several different posts on Stack Overflow. Founded in 2008, Stack Overflow has had over a decade to build up a library of programming Q&A’s, and whatever question you have has likely already been answered. Because of this, it’s common for programmer to find and copy code directly from the website.

Again, a website URL and date accessed would suffice, but if you want to cite the post properly then you’ll need to include some more information, including all of the posts you referenced.

GitHub user shanecelis has published a throughout Stack Overflow citation:

Original code Copyright (c) 2011 cdiggins[1]   
Modified code Copyright (c) 2016 Shane Celis, @shanecelis[2]Licensed under the CC-BY-SA 3.0[3]   Original code posted to this question[4] and answer[5] from where user contributions are licensed under   CC-BY-SA 3.0 with attribution required.   [1]:   
[5]: */ /*  CHANGES  
-------  May 21, 2016  [ENHANCEMENTS]  * Removed 'dynamic' keyword and made other small changes to support    Unity. (Could be considered a degradation rather than an    enhancement.)  [BUG FIXES]  * Now works with non-static delegates.  * Throws exception on `Match<void>` to stop Unity Editor from crashing. 
The reuse of code can be seen as good practice but copying other peoples computer code without citing it correctly may be a plagiarism violation. It is not always clear how to correctly reference programs and source code. The information on this page explains how to cite programs and source code correctly within reports and in the source code itself.  Remember, your professor is the final expert in this matter.  When in doubt, consult.

Similar Posts


No Comment.