Apache License 2.0: Terms, Rules, and How to Apply It

5 min read
In this article
  1. What the Apache License 2.0 Allows
  2. What the Apache License 2.0 Requires
  3. Apache 2.0 vs MIT, GPL, and BSD
  4. When to Choose Apache 2.0
  5. How to Apply Apache 2.0 to Your Project
  6. What Apache 2.0 Does Not Cover
  7. The Question to Decide

The Apache License 2.0 is a permissive open source license that lets anyone use, modify, distribute, and sell the code with few conditions. You must keep the original copyright notice, state significant changes, and include a copy of the license. It also grants an express patent license.

Released in January 2004, it carries the SPDX short identifier Apache-2.0 (SPDX license page) and was written by the Apache Software Foundation (ASF) to make reuse terms explicit across contributors and downstream users. The license is OSI-approved and is also recognized by the Free Software Foundation and the Debian Project, which matters when a project's distribution policy requires an approved license. This article describes the license; it is not legal advice for your specific project.

What the Apache License 2.0 Allows

Clauses 2 and 3 of the Apache License 2.0 text grant broad reuse rights. Clause 2 covers reproduction, derivative works, public display, public performance, sublicensing, and distribution; it is perpetual, worldwide, non-exclusive, no-charge, royalty-free, and irrevocable. The bullets below summarize the practical permissions:

  • Use the code for any purpose, including commercial use, without paying royalties.
  • Modify the code and create derivative works.
  • Distribute copies in source or object form, with or without modifications.
  • Sublicense the work to others, which allows re-licensing downstream within the same terms.

Clause 3 adds an express patent license from each contributor. It covers patent claims that are necessarily infringed by their contribution alone or in combination with the Work. The grant is perpetual, worldwide, royalty-free, and irrevocable except for a patent-litigation termination clause. The patent protection is one of the main reasons developers choose Apache 2.0 for code that will ship inside commercial products, where a hidden patent claim from an upstream contributor could otherwise create legal exposure for downstream users.

What the Apache License 2.0 Requires

The license is permissive, not condition-free. Section 4 of the license text spells out four redistribution conditions that apply after you have received the grant. For a broader view of these duties across licenses, see what open source licenses require.

  • Give each recipient a copy of the license (clause 4(a)).
  • Add prominent notices to modified files stating that you changed them (clause 4(b)).
  • Retain copyright, patent, trademark, and attribution notices, except those that do not apply to your derivative work (clause 4(c)).
  • If the original distribution includes a NOTICE text file, include a readable copy of those notices in your derivative work's NOTICE file, documentation, or generated display (clause 4(d)).

These conditions apply when you redistribute the work; private use and internal modification carry no notice obligations under the license. The record-keeping burden is heavier than MIT's because clause 4(b) asks you to mark changed files and clause 4(d) asks you to preserve attribution recorded in a NOTICE file. That trade-off buys the patent protection described above, which MIT does not provide.

Apache 2.0 vs MIT, GPL, and BSD

The difference between permissive and copyleft licenses becomes visible when you distribute a product. This table compares the four licenses you are most likely to meet when evaluating license types.

LicenseTypePatent grantAttribution / copyleftTypical use
MIT LicensePermissiveNo express patent grantRetain copyright and permission noticeSmall libraries and samples
Apache License 2.0PermissiveExpress patent grantRetain notices, state changes, preserve NOTICECommercial codebases, cloud-native projects
GPL-3.0CopyleftExpress patent grantDerivative works must be GPL-3.0Projects that require source reciprocity
BSD-3-ClausePermissiveNo express patent grantRetain notice; add non-endorsement clauseCode shared by universities and research groups

Apache 2.0 sits in the middle: it is permissive for the original code, but it asks for more record keeping than MIT because it also protects against patent claims. The license is compatible with GPL-3.0, a point noted in the Free Software Foundation's license list and reproduced on the Wikipedia entry. It allows linking from code under a different license, which makes it practical in codebases that mix open source and proprietary components. For a project where contributors are individual developers and no company holds relevant patents, MIT often wins on simplicity; for a project with corporate contributors or a legal review that wants an explicit patent grant, Apache 2.0 is the safer default.

When to Choose Apache 2.0

Apache 2.0 is a strong choice when contributions may carry patent risk. Companies often prefer it because the express patent grant in clause 3 covers both contributed code and the original Work in combination. The Apache Software Foundation uses Apache 2.0 as the default license for its packages unless otherwise stated, and many non-ASF projects have adopted it for the same reason. Cloud-native projects, SDKs, and code that will be embedded in proprietary products often select Apache 2.0 to get patent protection without copyleft obligations. Because the license does not require derivative works to stay open, a company can incorporate Apache-licensed components into a closed product and still comply by keeping notices. For a decision framework, see how to choose an open source license.

How to Apply Apache 2.0 to Your Project

Applying the license is a short checklist. The Apache Software Foundation's licensing FAQ recommends including a copy of the license, typically in a file called LICENSE, and considering a NOTICE file. The steps below follow that guidance and are the same whether your repository lives on GitHub, GitLab, or a private server.

  1. Copy the text of the Apache License 2.0 into a LICENSE file at the repository root. Do not alter the text; the official version is available as plain text from apache.org.
  2. Add a short header comment to each source file. Replace the year and owner: Copyright [yyyy] [name of copyright owner], followed by the standard Apache boilerplate or the shorter SPDX-License-Identifier: Apache-2.0 line. The SPDX identifier is recognized by scanners and lets a single line replace the full boilerplate.
  3. Create a NOTICE file if you redistribute code whose license requires preserving third-party notices. Even when not required, a NOTICE file documents attributions and makes downstream compliance easier to verify.
  4. Keep the LICENSE file with every distribution, including vendored copies and compiled artifacts. If your build produces a zip or container image, include the license file inside the artifact, not only in the repository.

The official FAQ lists both the full header and the shorter SPDX variant, so you can choose the form that fits your file conventions. Applying the license consistently from the first commit is easier than retrofitting headers later, especially on projects with many contributors.

What Apache 2.0 Does Not Cover

The license does not grant rights to the Apache trademark: the name "Apache" and related marks remain with the Apache Software Foundation. Sections 7 and 8 of the license text disclaim warranties and limit liability, so the code is provided on an "AS IS" basis. The license also does not require you to sign a contributor license agreement or to publish your changes under Apache 2.0; that would make it copyleft, which it is not. It also does not impose any obligation to contribute modifications back to the original project.

The Question to Decide

Do you need explicit patent protection without copyleft obligations? If a contributor's patent could otherwise block users, Apache 2.0's patent grant reduces that risk; if patents are not a concern, MIT may be enough. For a permissive license with different attribution terms, see the Artistic License 2.0.

outercurve.org Editors

Writing about open source software in practice: licenses, developer tools, data interoperability and the history of community-run projects.

Keep reading

Go up