Open Source Licenses Explained: MIT, Apache, GPL, AGPL and More
Open source licenses come in two main families. Permissive licenses such as MIT, BSD and Apache 2.0 let you reuse code in closed products if you keep the notices. Copyleft licenses such as the GPL require you to share source under the same terms when you distribute, and the AGPL extends that to network use.
- Permissive licenses (MIT, BSD, Apache 2.0) allow closed commercial use as long as you keep the copyright and license notices.
- Copyleft duties start when you distribute, and the GPL covers the whole program while LGPL and MPL 2.0 cover only the library or files.
- The AGPL adds a duty to offer source to network users of a modified version, which matters for SaaS products.
- Apache 2.0 grants an express patent license; MIT and BSD do not mention patents.
- Apache 2.0 code can go into GPLv3 projects but not the other way, and it cannot go into GPL-2.0-only projects at all.

On this page
- Permissive or copyleft: the split that decides most cases
- What MIT, BSD and Apache 2.0 let you do
- How GPL, LGPL and MPL keep code open
- AGPL and the SaaS gap in ordinary copyleft
- Open source license types compared in one table
- Which licenses can be combined in one product
- How to choose a license for your own project
- Mistakes teams make with licenses
- Frequently asked questions
Every open source project you install or copy code from comes with a license, and that file decides what you may do with the code. This guide sorts the common licenses by what they mean for a team that ships a closed product, publishes its changes, runs a web service or worries about patents.
Permissive or copyleft: the split that decides most cases
Almost every open source license you will meet belongs to one of two families. Permissive licenses let you take the code into anything, including a closed commercial product, as long as you keep the copyright and license notices. Copyleft licenses let you do the same things, but when you pass the software on, your version has to stay under the same terms with its source available.
Copyleft is a license rule that keeps derived versions as open as the original. The GNU General Public License (GPL) is the classic example. Lawyers and developers also talk about a middle group, weak copyleft, where the sharing duty covers only the licensed library or files rather than your whole program.
Both families are equally open source. Licenses from both appear on the list approved by the Open Source Initiative (OSI), which checks them against the Open Source Definition. The difference shows up once you change, combine or redistribute the code.
What MIT, BSD and Apache 2.0 let you do
MIT, BSD and Apache 2.0 are widely used permissive licenses in open source, and all three allow commercial use, modification and closed redistribution. They differ only in the small print on attribution, endorsement and patents.
- MIT License. A few short paragraphs. You must include the copyright notice and the permission text in all copies or substantial portions of the software, which in practice means a notices file shipped with your product. The code comes "as is," without warranty, and the text does not mention patents at all.
- BSD licenses. The 2-clause version works much like MIT. The 3-clause version adds one rule: you may not use the names of the copyright holder or contributors to endorse or promote your product without written permission.
- Apache License 2.0. Dated January 2004 and several times longer than MIT. Contributors grant you an express patent license, you must mark files you changed, and if the project ships a NOTICE file, its attribution text has to travel with your distribution.
The patent clause is the main practical reason to pick Apache 2.0 over MIT for larger projects. It also works defensively. If you file a lawsuit claiming the project infringes your patent, the patent license you received under Apache 2.0 ends on the date you file. MIT and BSD say nothing either way, which leaves patent questions to general law.
How GPL, LGPL and MPL keep code open
Copyleft duties start when you distribute the software, and they differ in how much of your code they reach. Running a modified GPL program on your own machines without handing copies to anyone else does not oblige you to publish your changes, according to the GNU Project's own FAQ.
The GPL is strong copyleft. If you distribute a program that includes GPL code, you have to offer the complete corresponding source of the whole work under the GPL. That is the heart of the GPL vs MIT question, since MIT lets you keep your additions closed, while the GPL asks you to open them once you ship. Two versions are in wide use. GPLv3, published in 2007, added explicit patent terms and rules against locking users out of modified software on devices. The Linux kernel stays on GPL-2.0 only, with a note that programs talking to the kernel through system calls are not covered by its terms. A Linux distribution bundles that kernel with many packages under other licenses, which is worth knowing when you are picking a first Linux distro for an office.
A file marked GPL-2.0-only cannot move to GPLv3, while GPL-3.0-or-later lets you pick any later version the Free Software Foundation (FSF) publishes. SPDX identifiers, the short standard license names used in file headers, spell out the difference so tools can read it.
Weak copyleft sits between the two families:
- LGPL (Lesser GPL). Version 3 is the GPLv3 plus extra permissions. You can link an LGPL library into a closed application, provided the user can swap in a modified version of the library, for example because you link it as a shared library.
- MPL 2.0 (Mozilla Public License). Copyleft applies file by file. Changes to MPL-licensed files must stay under the MPL, while your own new files in the same product can carry any license, including a proprietary one.
Weak copyleft fits libraries that their authors want improved in the open without scaring away commercial users. Firefox and LibreOffice both ship under the MPL 2.0.
AGPL and the SaaS gap in ordinary copyleft
The Affero version of the GPL (AGPL) closes a gap that the GPL leaves open for software offered over a network. Under the GPL, a company can modify a program, run it as a web service and never distribute a copy, so the duty to share source never kicks in.
Section 13 of AGPLv3, on remote network interaction, changes that. If you modify an AGPL program, your version must prominently offer users who interact with it over a computer network a way to get its corresponding source. A software-as-a-service (SaaS) product built on modified AGPL code therefore has to offer its source to the people who use it.

The AGPL also shows up in license fights between vendors and cloud providers. Elastic, which had moved Elasticsearch and Kibana away from an open license, announced on August 29, 2024 that it would add the AGPL as a license option next to its own Elastic License and the SSPL. The SSPL is a source-available license, not an OSI-approved one, so for teams that care about the open source label the AGPL option is the one that counts.
If you only self-host an unmodified AGPL tool for your staff, such as a wiki or a project tracker, Section 13 has nothing to trigger. The practical side of running those services, including when self-hosting pays off, has its own article.
Open source license types compared in one table
This comparison summarizes the license texts and the FAQs of their publishers; edge cases depend on how the code is combined and shipped.
| License (family) | Use in a closed product | Publish your changes |
|---|---|---|
| MIT (permissive) | Yes, keep the notice | No |
| BSD-2-Clause, BSD-3-Clause (permissive) | Yes, keep the notice; 3-clause bans endorsement | No |
| Apache-2.0 (permissive) | Yes, keep notices and NOTICE file, mark changes | No |
| MPL-2.0 (weak copyleft) | Yes, your separate files can be closed | Changes to MPL files, when distributed |
| LGPL-3.0 (weak copyleft) | Yes, if users can replace the library | Changes to the library, when distributed |
| GPL-2.0, GPL-3.0 (strong copyleft) | No, the whole distributed work goes under the GPL | Full source, when distributed |
| AGPL-3.0 (network copyleft) | No, the whole distributed work goes under the AGPL | Full source, when distributed or offered over a network after modification |
Read the table from left to right as a filter. If your product stays closed, every row with "No" in the closed-product column is out, unless you can keep that component separate. If you sell a hosted app, check the last column first, because only the AGPL row adds a duty for network use.
Can you use this code?
1. Your closed desktop app bundles an MIT-licensed library. What do you owe?
- The source code of your whole app
- The MIT copyright and permission notice, shipped with the app
- Nothing, MIT has no conditions
Answer
Answer: B. MIT allows closed use, but its notice has to travel with all copies.
2. You sell a product to customers, and it includes GPL code. What applies?
- You may keep your own additions closed
- You must offer the complete corresponding source under the GPL
- Only the GPL files themselves must be opened
Answer
Answer: B. Strong copyleft covers the whole distributed work.
3. You modify an AGPL tool and run it as a SaaS for outside users. Pick the duty that applies.
- No duty, because you never hand out copies
- You must offer those users its source
- Only your staff may use it
Answer
Answer: B. Section 13 of AGPLv3 covers users who interact with a modified version over a network.
Which licenses can be combined in one product
License compatibility decides whether code under two licenses can legally ship as one program. Permissive code can flow into almost any project, while copyleft code pulls the combined work toward its own terms. Problems appear when two copyleft licenses demand different terms for the same work.
Three combinations come up again and again.
Does not work
- Apache 2.0 into a GPL-2.0-only project does not work, according to the FSF, because of the patent and termination terms Apache adds.
- GPL-2.0-only and GPLv3 code cannot be merged into one program. Code marked "or later" avoids this, since it can be used under version 3.
Works
- Apache 2.0 into GPLv3 works. The Apache Software Foundation describes the compatibility as one-way: Apache code can go into a GPLv3 project, but GPLv3 code cannot go into an Apache-licensed project.
As a rule of thumb, code moves from more permissive to more restrictive, not back. The FSF keeps a long annotated list that marks each license as compatible or incompatible with the GPL, and it is the quickest place to check an unfamiliar one.
How to choose a license for your own project
Pick the license by what you want others to be able to do with your code, then match the community you are joining. The sequence below works for a new library, an internal tool you plan to publish or a product you want to open up:
- Closed use Decide whether others may build closed products on your code. If yes, go permissive; if you want improvements to come back, go copyleft.
- Patents Check for patents. If your company holds patents or the code sits in a patent-heavy area, prefer Apache 2.0 over MIT or BSD.
- Copyleft reach Decide how far copyleft should reach. For a library, LGPL or MPL 2.0 keeps the library open without forcing apps that use it to open up. For an application, GPLv3 covers the whole program.
- Web service If people may run your software as a web service, decide whether hosted versions should share their changes. If they should, the AGPL is the license built for that.
- Ecosystem Look at the ecosystem. Match the license of the language community or the larger project you plug into, and check compatibility with your dependencies.
- License file Put the full license text in a LICENSE file at the top of the repository and add SPDX identifiers to file headers.

Take a small team that publishes a helper library and hopes other companies adopt it. A permissive license removes the main barrier to adoption, and the patent check from step 2 tells you whether Apache 2.0 is worth its extra paperwork. The choosealicense.com site walks through the same decision in plain language and shows the full text of each option.
Mistakes teams make with licenses
License problems in a product usually trace back to a skipped check rather than a deliberate choice. Common ones:
- Treating code with no license as free to use. Without a license, copyright law keeps all rights with the author, so you can read the code but not reuse it.
- Shipping a product without the notices file. Even MIT, the shortest common license, requires its notice in your distribution.
- Assuming no copyleft license touches a web app. The GPL does not for network use alone, but an AGPL component changes that once you modify it and let users reach it over a network.
- A single GPL file copied into a closed codebase "just to test" stays there, unnoticed, until the product ships.
- The suffixes "only" and "or later" get skipped in reviews, although they decide which combinations are allowed.
- A license checked once is not checked for good. Projects relicense new releases, so check again before major upgrades.
Several of these become visible before release with a simple SBOM, the software bill of materials that names each component with its SPDX identifier. If you are still sorting out what counts as open source in the first place, the basics are in the plain-English guide to open source software. Further guides on single licenses live in the Licenses section.
Frequently asked questions
Can I sell software that includes GPL code?
Yes. The GPL puts no cap on the price you ask, yet each customer also receives the source and the freedom to modify and redistribute the program, so any buyer may pass it on for free. Sellers of GPL software can still charge for support, services or hosting, but secrecy of the code is never part of the deal.
Is code on GitHub without a license free to use?
No. Without a license, copyright law keeps all rights with the author, so you may read the code but not copy, modify or ship it. GitHub's terms let other users view and fork public repositories on the site, which is far less than a reuse right. Ask the author to add a license before you depend on it.
Why would a project pick Apache 2.0 over MIT?
Patent cover is usually the deciding factor. Every contributor to an Apache 2.0 project licenses users the patents their contribution relies on, and MIT has no wording on the subject at all. In exchange, anyone who reuses Apache code takes on extra housekeeping, such as flagging modified files and passing the NOTICE text along.
Can a project change its license later?
Yes, the copyright holders can release new versions under different terms, but versions already published keep their original license. That is how forks start when a vendor moves away from open source. Changing the license is hard for projects with many outside contributors, because each one holds copyright in their code unless they signed it over.
Do copyleft rules apply to software we only use internally?
Usually not. Passing a GPL program around among employees of one organization does not count as distribution in the GPL's sense, so in-house changes can stay private. The AGPL draws a wider line, because every user who interacts with a modified version over a network is entitled to receive its code.
References (21)
- Open Source Initiative: OSI Approved Licenses
- Open Source Initiative: The MIT License
- Open Source Initiative: The 3-Clause BSD License
- Apache Software Foundation: Apache License, Version 2.0
- Apache Software Foundation: Apache License v2.0 and GPL Compatibility
- Open Source Initiative: GNU General Public License version 3
- Open Source Initiative: GNU Lesser General Public License version 3
- Open Source Initiative: GNU Affero General Public License version 3
- GNU Project: Frequently Asked Questions about the GNU Licenses
- GNU Project: Various Licenses and Comments about Them
- Mozilla: MPL 2.0 FAQ
- Mozilla Public License
- LibreOffice: Licenses
- The Linux Kernel documentation: Linux kernel licensing rules
- SPDX License List
- Elastic: Elasticsearch is Open Source. Again!
- Choose a License: Licenses
- Choose a License: No License
- TechCrunch: Open source licenses, everything you need to know
- Snyk: Open Source Licenses, Types and Comparison
- FOSSA: The Complete Guide to Open Source Licenses

