Compatibility means "can they be distributed together?"
Two licenses are compatible if, when code under each is combined and distributed as a single program, the conditions of both licenses can be met at the same time. If either license forbids a condition of the other, they are incompatible. For example, the GPL requires that no further restrictions be added, so code under a license with additional conditions the GPL does not permit cannot go into a GPL program.
Compatibility has a direction
Permissive code can go into copyleft projects, but not the other way around.
- MIT code → GPL project: Allowed. As long as you keep the MIT notice, the whole combined work can be distributed under the GPL.
- GPL code → MIT project: The whole combined work must follow GPL terms, so it cannot remain an "MIT project".
That is why a compatibility table must always be read as "which code → into which project".
Common combinations
Apache-2.0 and the GPL
The FSF considers Apache-2.0 compatible with GPL-3.0 but not with GPL-2.0, because Apache-2.0's patent termination and indemnification clauses are additional conditions not found in GPL-2.0. GPL-3.0 was designed to solve this problem. Therefore a GPL-2.0-or-later project can use Apache-2.0 code by distributing the combined work under GPL-3.0.
MPL-2.0 and GNU licenses
Section 1.12 of MPL-2.0 defines GPL-2.0, LGPL-2.1, AGPL-3.0 and later versions as "Secondary Licenses", and Section 3.3 allows a Larger Work combining MPL code with such code to be distributed under the GNU license. The exception is when the original author attached Exhibit B ("Incompatible With Secondary Licenses").
LGPL libraries and closed-source apps
An LGPL library can be used in closed-source apps. In return, users must be able to replace the library with a modified version (dynamic linking is easiest), and you must provide the source of the library part and the license notice. If you copy LGPL code into your app's source and mix it, things change: the combined work must follow LGPL/GPL terms.
GPL-3.0 and AGPL-3.0
The two licenses expressly permit combination through each other's Section 13. In the combined work, the GPL part keeps following GPL terms, and the AGPL part keeps following AGPL terms, including the condition to provide source over a network.
EPL-2.0 and the GPL
EPL-2.0 is incompatible with the GPL by default, but combination becomes possible if the original author designates the GPL or another license as a Secondary License via Exhibit A.
| Imported code | Closed-source app | MIT project | GPL-2.0-only | GPL-3.0 |
|---|---|---|---|---|
| MIT, BSD, ISC | Yes (notice) | Yes | Yes | Yes |
| Apache-2.0 | Yes (notice, NOTICE) | Yes | No | Yes |
| MPL-2.0 | Conditional (publish files) | Conditional | Conditional (Secondary) | Conditional (Secondary) |
| LGPL-3.0 | Conditional (linking) | Conditional (linking) | No | Yes |
| GPL-3.0 | No | No | No | Yes |
How far does "combination" go?
Compatibility problems arise when code is combined into a single program. The FSF regards code linked into the same executable or sharing complex internal data structures as one program, while ordinary communication between separate programs, such as pipes, sockets and command-line arguments, is usually regarded as an "aggregate" of separate programs. However, this line has not been settled by court precedent, and interpretations differ. Simply shipping several programs together in one distribution is not a combination.
Practical steps
- Extract your dependency list (with your package manager's license reporting feature or an SBOM tool).
- Record each dependency's license as an SPDX identifier.
- Do a first check of each pairing with your project's license in the compatibility checker.
- For "conditional" pairs, check the conditions (notices, linking method, Secondary License status) in the license texts.
- If any pair is not allowed, replace the dependency, separate the programs or adjust your license.
This article is general information, not legal advice. Consult a professional for important decisions.
Sources
- GNU license FAQ (compatibility matrix, MereAggregation) — https://www.gnu.org/licenses/gpl-faq.html
- FSF, Various Licenses and Comments about Them — https://www.gnu.org/licenses/license-list.html
- Apache Software Foundation, GPL Compatibility — https://www.apache.org/licenses/GPL-compatibility.html
- Mozilla, MPL 2.0 FAQ — https://www.mozilla.org/en-US/MPL/2.0/FAQ/
- Eclipse Foundation, EPL 2.0 FAQ — https://www.eclipse.org/legal/epl-2.0/faq/