Open Source License Compatibility: Which Licenses Can Be Combined?
Learn which open source licenses are compatible with each other. Understand why license compatibility matters and how to handle multi-licensed dependencies.
Detailed Explanation
Open Source License Compatibility
License compatibility determines whether code under one license can be combined with code under another license. Incompatible licenses mean you cannot legally merge or link the code together.
Why Does Compatibility Matter?
Modern software projects depend on hundreds of libraries. If any two dependencies have incompatible licenses, you may not be able to legally distribute the combined work. Understanding compatibility is essential for compliance.
Compatibility Matrix (Simplified)
| From \ To | MIT | Apache-2.0 | GPL-2.0 | GPL-3.0 | LGPL-3.0 | MPL-2.0 |
|---|---|---|---|---|---|---|
| MIT | Yes | Yes | Yes | Yes | Yes | Yes |
| Apache-2.0 | No* | Yes | No | Yes | Yes | Yes |
| GPL-2.0 | No | No | Yes | No** | No | No |
| GPL-3.0 | No | No | No | Yes | No | No |
| LGPL-3.0 | No | No | No | Yes | Yes | No |
| MPL-2.0 | No | No | No | Yes | Yes | Yes |
*Apache-2.0 code cannot be relicensed as MIT (losing patent grant). **GPL-2.0-only is not compatible with GPL-3.0; GPL-2.0-or-later is.
Key Rules
- Permissive to copyleft — Code under permissive licenses (MIT, BSD, ISC) can generally be incorporated into copyleft projects
- Copyleft to permissive — Code under copyleft cannot be relicensed under a permissive license
- GPL-2.0 vs GPL-3.0 — These are NOT compatible unless the code is licensed as "GPL-2.0-or-later"
- Apache-2.0 and GPL — Apache-2.0 is compatible with GPL-3.0 but NOT with GPL-2.0
Handling Incompatible Licenses
- Separate processes — Run incompatible code in separate processes communicating via APIs
- System libraries exception — GPL allows linking to system libraries
- Dual licensing — Ask the author to dual-license under a compatible license
- Rewrite — Replace the incompatible dependency with a compatible alternative
Tools for Checking Compliance
license-checker(npm) — List licenses of all dependenciescargo-license(Rust) — Show licenses of crate dependencies- FOSSA, Snyk, WhiteSource — Enterprise license compliance tools
Use Case
Evaluating whether you can combine multiple open source libraries in a single project, creating a company policy for acceptable licenses, or preparing for open source compliance audits.
Try It — License Identifier
Related Topics
How to Choose an Open Source License for Your Project
Guides
Permissive vs Copyleft Licenses: Key Differences Explained
Guides
GPL v3.0: Strong Copyleft for Software Freedom
Individual Licenses
Apache License 2.0: Permissive with Patent Protection
Individual Licenses
MIT License: The Most Popular Open Source License
Individual Licenses