Is code written by the United States Government (its employees, or if for some reason we start electing a Code Czar... then elected officials) subject to the Freedom of Information Act (FOIA)?

Wikipedia suggests that any code written by the United States Government would not be copyrighted.

Wired has a very cool article about NASA open-sourcing its code, but a government agency willingly and pre-emptively open-sourcing code is not the same as that code being subject to FOIA and required to be made available upon request.

And as an extension of this question, if the government subcontracted out some code work, would this code also be subject to FOIA (presumably the subcontractor might hold a copyright that the USGov wouldn't necessarily hold)? Would it matter if the subcontractor were providing the government with uncompiled source code versus compiled binary?

Link to the United State's Freedom of Information Act website.

  • 1
    This is mostly purely a legal question. Not sure if it fits here or not.
    – user1530
    Feb 4, 2015 at 23:12
  • 3
    There's no Lawyers.SE. :/ I wasn't 100% sure if it was a fit here, but felt it might be since it's asking about a government policy.
    – nhgrif
    Feb 4, 2015 at 23:24
  • 2
    Four years later, there is now a Law.
    – Bobson
    Feb 7, 2019 at 21:37

4 Answers 4


In order to obtain a copy of the source code, you first must be able to stipulate that the government actually has a copy of it. tldr; There's two ways that the government can get a copy: either produce it in house or state in the procurement contract that the contractor producing it must divulge it to the government.

Government Software Development

It is my understanding that government employees / agencies themselves cannot (or should not) directly create 'code' per se. The reasoning behind this is that the government is not there to compete with entities in the private sector, and should procure tangible / intangible goods and services from the private sector where possible.

I was able to find a quote here from 1980 where the White House Conference on Small Business said:

The Federal Government shall be required by statute to contract out to small business those supplies and services that the private sector can provide. The government should not compete with the private sector by accomplishing these efforts with its own or non-profit personnel and facilities.

Additionally, there's the Federal Activities Inventory Reform Act of 1998 that basically requires executives of government agencies to maintain a list of their functions which they deem to be "of activities performed by Federal Government sources for the executive agency that, in the judgment of the head of the executive agency, are not inherently governmental functions."

However, I believe if an agency had a capable individual or team working for them and could develop small, time saving applications that aren't really applicable to any other segment of the general market then that is fair game for the government to create in-house.

Contracting outside parties for development

That being said, I think the relevant regulation concerning this type of procurement is FAR 12.212:

(a) Commercial computer software or commercial computer software documentation shall be acquired under licenses customarily provided to the public to the extent such licenses are consistent with Federal law and otherwise satisfy the Government’s needs. Generally, offerors and contractors shall not be required to—

(1) Furnish technical information related to commercial computer software or commercial computer software documentation that is not customarily provided to the public; or

(2) Relinquish to, or otherwise provide, the Government rights to use, modify, reproduce, release, perform, display, or disclose commercial computer software or commercial computer software documentation except as mutually agreed to by the parties.

(b) With regard to commercial computer software and commercial computer software documentation, the Government shall have only those rights specified in the license contained in any addendum to the contract.

So, no. The government is no more powerful when it comes to getting source code or extra technical documentation from it's vendors than we are in that it cannot force private entities to relinquish that information without a signed contract. The government can, however, stipulate extra conditions in the procurement contract that require such divulgence, but it is by no means necessary for them to do so.

The government has it, so can I force them to show me teh codez?

Regardless, even if the government has a copy of the source code of an application developed by a contractor, FOIA can only be used to target agency records. In the definitions section of FOIA, source code is determined not to be classified as an agency record (emphasis mine):

(ii) Administrative tools by which records are created, stored, and retrieved, if not created or used as sources of information about organizations, policies, functions, decisions, or procedures of a DNA organization. Normally, computer software, including source code, object code, and listings of source and object codes, regardless of medium are not agency records. (This does not include the underlying data which is processed and produced by such software and which may in some instances be stored with the software.) Exceptions to this position are outlined in paragraph (b)(3) of this section.

The paragraph (b)(3) concerning exceptions to the above definition states:

(3) In some instances, computer software may have to be treated as an agency record and processed under the FOIA. These situations are rare, and shall be treated on a case-by-case basis. Examples of when computer software may have to be treated as an agency record are:

(i) When the data is embedded within the software and cannot be extracted without the software. In this situation, both the data and the software must be reviewed for release or denial under the FOIA.

(ii) Where the software itself reveals information about organizations, policies, functions, decisions, or procedures of a DNA office, such as computer models used to forecast budget outlays, calculate retirement system costs, or optimization models on travel costs.

  • 1
    I'm not asking if the govt can use FOIA to get source code from a non-govt entity. I am asking if a non-govt entity can use FOIA to get source code from the govt. Govt agencies (such as NASA) have source code... And I have applied for an interviewed for a position in a county govt as a programmer. I know local and federal are different, but still...
    – nhgrif
    Feb 5, 2015 at 16:44
  • see my update, that should fully answer your question.
    – user5155
    Feb 5, 2015 at 16:44
  • 1
    I'd contest the very first claim in this: Goverment has to step up to fund basic research because the private sector is not gonna do that itself. There's loads of studies and explanations on this I'll just quote these jec.senate.gov/public/… bloomberg.com/bw/stories/2008-12-17/… nsf.gov/statistics/nsb0803/start.htm
    – user45891
    Feb 6, 2015 at 18:53
  • Research may be one thing, but I don't think that's the issue. My claim is that the government couldn't hire a bunch of programmers to produce e.g. healthcare.gov. that would need to be accomplished through contractors (and was). R&D is a completely different beast than products that are already available on the market.
    – user5155
    Feb 6, 2015 at 18:59
  • 1
    Actually, at least the Agency I support, has in it's job vacancy notifications requirement to be able to code. It is expected that all employees (civilian and military) should write code ad hoc in order to better complete their assigned tasks, no matter the position. So that is not true at least in one three-letter agency.
    – CGCampbell
    Sep 15, 2021 at 17:20

I have worked for a government contractor writing software for the US Department of Energy for more than 35 years. When DOE pays my company to write a custom software product for them it is quite clear that the resulting product belongs to my company. The government has paid for a perpetual non-exclusive license to use that software and any other agency may get a copy for their own use. My company is free to protect the software with a copyright or patent and sell licences to anyone except where restricted by law such as export control law.

When DOE closes down a project all the records go to record storage for an indefinite retention period. The software is never included in the records that go to storage. Since a FOIA request is a request for records, I doubt that you would be successful in getting any kind of software.


As far as I understand, FOIA is not about copyright at all.

Works, created by US government officers and employees, that ‘normally’ would be copyrighted, including software, are indeed in public domain under section 105 of the Copyright Act. However works, created for the US government by the contract are not in public domain.

Also, if software is in public domain, it does not always mean that it is free / libre / ‘open source’. It’s not a painting. Software might be released only in binary or other ‘obscure’ form; and I do not know an act that prohibit that to US government. Such a program should be considered non-free / proprietary since we have to obtain sources to exercise the right to modify a software.

  • 1
    FOIA isn't about copyright at all. The copyright tag is probably inappropriate. This question is about FOIA and how it applies to source code created by the US Government.
    – nhgrif
    Feb 5, 2015 at 0:49

It all depends on the agency and software. APRWin for example, the program used by the OCC to verify Annual Percentage Rates on regulated loans. It is quite common for people to request the source code via FOIA request, and it is granted all the time.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .