Java code

Citing Source Code in MLA Style

By Joseph Wallace

To cite source code—the written portion of a piece of software or a larger program—begin with the MLA format template.1 In what follows, I explain how elements on the template apply to source code and show you how to construct an entry.


Source code can be written by a person, a group of persons, or an organization (e.g., Chromium Authors). Authors are usually specified in the code itself or, on a Web site like GitHub, as the owner of the repository in which the code appears. If individual contributors are not given, treat the organization named as the owner of the license or the holder of the copyright as the author. If the organization is both author and publisher, begin your entry with the title. 

In the rest of the post, I walk you through the process of creating a works-cited-list entry for a work of source code,, where the publisher is the author.

Title of Source

Source code is typically presented in discrete text files, and the file name can serve as the title. When citing titles in MLA style you would normally standardize the capitalization. However, you should not do this for titles of source code. The cases of characters are meaningful in a programming context, so you should reproduce the file name exactly as you found it. Provide the file extension when you give the title. Examples of file extensions on source code files include .java for Java code, .cc for C++ code, and .py for Python code. To cite the source code for, begin your entry with the title:

Title of Container

The container will be either the name of the software or the package in which the code is found.2 A package is a container of source code files within a larger program. The code for a piece of software is contained in the software itself, and so the software is the container. For, the container is Apache Hadoop, a collection of software: Apache Hadoop,


Since source code often exists in several versions, provide the version of the code you consulted. This could be a version of software, a particular revision in a repository, or a commit hash (a unique string of letters and numbers that identifies a version of a piece of code). This is important information because both URLs and source code tend to change, so providing as much information as possible makes it more likely that readers will be able to find what you are citing. In the example that follows, the commit hash appears after the package name and specifies the version of the code being cited: Apache Hadoop, commit ef9946cd52d54200c


The publisher for the software or the package in which the code is found is usually the organization that produced the code. Here, the software that contains the source code is published by the Apache Software Foundation: Apache Hadoop, commit ef9946cd52d54200c658987
c1dbc3e6fce133f77, Apache Software Foundation,


The date may not be specified in source code, in which case you can omit it. If you do see a date, provide it: Apache Hadoop, commit ef9946cd52d54200c658987
c1dbc3e6fce133f77, Apache Software Foundation, 2015.

Since there is no information relevant to the “Location” element, this is the end of container 1.

Title of Container 2

If you are consulting code on a Web site, you will need to provide information for that Web site as the second container. In what follows, the Web site GitHub is the second container. No publisher is specified for the Web site GitHub, because it is published by GitHub (MLA Handbook 42). Apache Hadoop, commit ef9946cd52d54200c658987
c1dbc3e6fce133f77, Apache Software Foundation, 2015. GitHub,


If you are documenting source code on a Web site, provide the URL as the location. The MLA recommends removing “http://” and “https://” protocols from URL addresses in printed works, in which the creation of hyperlinks is irrelevant, although if the protocol is anything else, such as “ftp://,” you should include it. If you are citing these sources in a format that has the ability to display hyperlinks—for instance, if they will be displayed in html—do include the protocol. If the URL does not provide the full path to the file, you should include the full path as the file name. In the example that follows, the URL comes after the container and provides the full path to the file. Apache Hadoop, commit ef9946cd52d54200c658987c1dbc3e6fce133f77, Apache Software Foundation, 2015. GitHub,
java/org/apache/ hadoop/record/

The examples of in-text citations that follow are adapted from links posted on MIT’s Web site devoted to academic integrity (“Writing Code”). For in-text citations, if you are citing a particular method, class, subroutine, or block of code, provide the line number or numbers if known.

“The method OutputTraceToStream may be found in, source code written for the Chromium project” (Chromium Authors, line 59).

“As the developers note, this ‘utility class’ was intended to give ‘applets the ability to detect proxy host settings’” (   

Works Cited

Chromium Authors. Chromium, commit c566864c0ebfa9f46a8b61cb6c587444580fe494, Adobe Systems Incorporated, 2011. GitHub,
blob/master/base/debug/ HttpClient, version 3.0, Apache Software Foundation. Apache Software Foundation,


I thank Ryan Williams, former senior Web developer at the MLA, for his assistance with this post.

1. A fuller definition of source code, as defined by Merriam-Webster’s Collegiate Dictionary, is “a computer program in its original programming language (such as FORTRAN or C) before translation into object code usually by a compiler” (“Source Code, Noun”). The Linux Information Project specifies that “source code” is “the version of the software as it is originally written (i.e., typed into a computer) by a human in plain text (i.e., human readable alphanumeric characters)” (“Source Code Definition”).

2. Usually when citing works in MLA style, you would not consider software to be a container. For example, in the case of a work downloaded from the Internet as a PDF and opened with Adobe Reader DC, Adobe Reader DC is not the container but the tool you used to open the work. When you’re citing source code, however, the software is the work.

Works Cited


“Source Code, Noun.”  Merriam-Webster’s Collegiate Dictionary, 2018,

“Source Code Definition.” The Linux Information Project, 23 May 2004,

“Writing Code.” Academic Integrity at MIT: A Handbook for Students,

Published 15 October 2018

3 comments on “Citing Source Code in MLA Style”

  1. So, for MLA style do we write Microsoft Excel (without italics) or do we italicize Microsoft Excel when these words appear in our text? For example, I notice that in Note 2 above the words Adobe Reader DC are italicized.

    • Thanks for your comment. Microsoft Excel would be italicized in the text. MLA style treats the name of a piece of software as a title, which is italicized like other titles.

Join the Conversation



Fields marked with * are required.

Your e-mail address will not be published.

Get MLA Style News from The Source


The Source Sign-up - Style Center Footer