Skip to main content
All posts
Open Source5 min read10 views

Open Source Licenses Explained: MIT, Apache 2.0 and GPL

Not sure which open source license to pick or follow? This guide explains permissive and copyleft licenses, including MIT, Apache 2.0, BSD, GPL and AGPL, in plain language.

Admin

FOSS Andhra community volunteer writing about free and open source software, education and developer tools from Andhra Pradesh.

Every open source project has a license. It is the legal document that tells everyone what they are allowed to do with the code. Choosing and following the right license is part of being a good open source citizen.

This article is an overview, not legal advice. Read the full license text and seek advice for important decisions.

Two main families

Permissive licenses

Permissive licenses let people do almost anything with the code, including using it in closed-source commercial products, as long as they keep the copyright notice and the license text.

  • MIT: very short and simple. Anyone can use, copy, modify and distribute the software if the notice is kept.
  • BSD (2-clause and 3-clause): similar to MIT, with a few extra conditions in the 3-clause version.
  • Apache License 2.0: permissive like MIT, but it also includes an explicit patent grant from contributors and requires notice of changes.

Copyleft licenses

Copyleft licenses require that if you distribute modified versions or software built on the code, you share them under the same or a compatible license. This keeps improvements open for everyone.

  • GPL (GNU General Public License): strong copyleft. Distributed derivative works must also be released under the GPL, with source code available.
  • LGPL (Lesser GPL): a weaker copyleft often used for libraries, so that other software can link to them without being forced under the same terms.
  • AGPL (Affero GPL): like the GPL, but also applies when users interact with the software over a network, so hosting a modified version as a service requires sharing the source.

Quick comparison

LicenseTypeUse in closed-source productsMust share source of changes
MITPermissiveYesNo
BSDPermissiveYesNo
Apache 2.0Permissive (patent grant)YesNo
LGPLWeak copyleftYes, with conditionsFor the library itself
GPLStrong copyleftNot unless the whole work is GPLYes, when distributed
AGPLNetwork copyleftNot unless the whole work is AGPLYes, including network use

Licenses for non-software work

Documentation, images and writing often use Creative Commons licenses rather than software licenses. For example, CC BY allows reuse with attribution, while CC BY-SA also requires derivatives to use the same license.

How to choose a license for your project

  1. Want maximum adoption and few restrictions? Consider MIT or Apache 2.0.
  2. Want patent protection for users and contributors? Apache 2.0 is a common choice.
  3. Want improvements to stay open? Consider the GPL, or the AGPL for network services.
  4. Joining an existing project? Follow the license it already uses.

You can find helpful guidance at choosealicense.com, and the Open Source Initiative lists approved licenses.

Always include a LICENSE file

A project without a license is not open source by default: the author keeps all rights, and others have no clear permission to use it. Put a LICENSE file in the root of your repository.

Learning to contribute? Read How to Make Your First Open Source Contribution next, or join FOSStar to connect with the FOSS Andhra community.

Take the next step

Explore our internship openings, become a FOSStar member, or meet the community at an upcoming event.