Find the group of your library, then follow its rules. The groups run from the fewest rules to the most.
The six groups
| Group | Licenses | What you must do | Closed product? |
|---|---|---|---|
| 1. Almost no rules | Unlicense, CC0-1.0 |
• Nothing. • CC0 gives no patent rights. |
Yes |
| 2. Few rules | MIT, BSD-2-Clause, BSD-3-Clause, Apache-2.0, BSL-1.0 |
• Keep the copyright and license notice. • Apache-2.0: also say what you changed. • BSD-3-Clause: don’t use the authors’ names to promote your product. • BSL-1.0: the notice is needed when you share the source code. |
Yes |
| 3. Share your changes to the library | MPL-2.0, LGPL-2.1, LGPL-3.0, EPL-2.0 |
• Share your changes to the library and let users get it. • Keep the notice. • LGPL: users must be able to replace the library. |
Yes, if you follow the rules |
| 4. Share everything | GPL-2.0, GPL-3.0 |
• If you give software that includes this code to others, share the source of the whole program under the same license. | No, unless you share your source |
| 5. Share everything, even for web apps | AGPL-3.0 |
• The same as the GPL. • Also when people use your changed version over a network. |
No. Avoid it in a closed SaaS |
| 6. Paid (commercial) license | Dual-licensed libraries, or commercial-only software | • Pay, and follow the contract. • Check if you may ship it to customers, use it in a SaaS, and how the price is counted. |
Yes, as the contract says |
Closed product means software whose source code you keep private, such as an app you sell or a SaaS. Users get the app, but not the code. The opposite is open source, where anyone can read the code.
Before you choose
Ask one question: do you give the software to other people?
- Yes. An app, installer, device or Docker image for customers counts. Frontend code that goes to the browser counts too. The rules above apply.
- No, it only runs on your own server. The GPL sharing rule usually doesn’t apply. The AGPL is the exception, because it also covers people who use your changed version over a network.
- A microservice that uses a GPL library. If it is a separate program that your other services call through a standard interface, the GPL usually covers only that service. This is a gray area, so ask a lawyer.
If you must share the source, you give it to the people who receive the software, not to the whole world. You can still charge for your software.
Caution
This is a simple summary, not legal advice. Read the full license, and ask a lawyer for important projects.
Read a real story: Using a Free Library? You Could Be Sued for $700K. More details: Choose a License.
Frontend, mobile or backend: do you give it to others?
The rules are the same. What changes is where your code runs, because that decides if you give the software to other people.
| Frontend (browser) | Mobile app | Backend (your server) | |
|---|---|---|---|
| Where it runs | In the user’s browser | On the user’s phone | On your own server |
| Do you give it to others? | Yes, every visitor gets a copy | Yes, every user installs a copy | No, unless you ship it to a customer |
| GPL or LGPL library | The sharing rules apply | The sharing rules apply. App store terms can clash with the GPL, so ask a lawyer first | Usually no sharing. The AGPL still applies |
| Keep the notice | On a licenses page of your site | On an About or Licenses screen in the app | Keep the list in your repo, and in what you deliver to customers |
A backend that you install at a customer’s site or send as a Docker image counts as giving it to others, the same as a frontend or mobile app.
Keep the license and notice
Groups 2 to 5 ask you to keep the copyright and license notice. Do this:
- Don’t delete the license lines at the top of source files or the
LICENSEfile inside a library’s folder. - List every library you ship in one file, such as
THIRD-PARTY-NOTICES.txt. For each one, write the name, version, license and copyright line, then paste the full license text. Use a plain text file, because anyone can open it. - Apache-2.0: if the library has a
NOTICEfile, copy its content into your file too. Also mark the files you changed. - Ship the file with your product, where users can find it: next to the installer, on an About screen, or on a
/licensespage for a web app. - Update the file when you add or upgrade a library.
Sample:
# Third-party notices
This product includes the following open source software.
## example-lib 2.1.0
License: MIT
Copyright (c) 2024 Example Author
(paste the full MIT license text here)
Real examples from public projects: vscode-yaml notices is short and easy to read. PSRule notices is a longer one that lists .NET libraries such as Newtonsoft.Json.
Frontend code: build tools can remove license comments from the bundle. The notices file keeps the text safe.
Tools can make the list for you, such as license-checker for npm, pip-licenses for Python and nuget-license for .NET. Check the result, because a tool may miss the notice text.
Where visitors find it
A visitor doesn’t install anything. The site owner must make the notices easy to find:
- Add a footer link, such as “Open source licenses”, to a notices page.
- List the frontend libraries there with their licenses.
- For GPL code, also link to the frontend source code and the build instructions.
As a visitor, look in the footer or on an About or Legal page. You can also open the browser developer tools (F12) and read the top of the JavaScript files, where some libraries leave a license comment.
Real example: Planner 5D. On its website, open the footer, then Legal Hub, then Licenses. That page has a notices page for each platform: web, iOS, Android and Windows. The web notices page shows the full text of each license once, followed by the components that use it.